Skip site navigation (1) Skip section navigation (2)

where clauses with and

From: "paul butler" <paul(at)entropia(dot)co(dot)uk>
To: pgsql-novice(at)postgresql(dot)org
Subject: where clauses with and
Date: 2002-10-17 12:42:52
Message-ID: T5dfefe9b20ac1785c30d4@pcow058m.blueyonder.co.uk (view raw or flat)
Thread:
Lists: pgsql-novice
Here's an odd one:
I can't seem to make a where clause containing 'and' work

db=# select orgname,usertype from users where usertype='Drug 
Addiction';
              orgname               |    usertype
------------------------------------+----------------
 Turning Point Scotland             | Drug Addiction
 Govan Youth Access Project         | Drug Addiction
 Community Learning West Team       | Drug Addiction
 Possil Learning Centre             | Drug Addiction
 Langside College (Glenwood Campus) | Drug Addiction
 Rehab Remanufacturing Services Ltd | Drug Addiction
 Greater Pollok Addiction Service   | Drug Addiction

db=# select orgname,usertype from users where usertype='Alcohol 
Addiction';
              orgname               |     usertype
------------------------------------+-------------------
 Possil Learning Centre             | Alcohol Addiction
 Greater Pollok Age Concern         | Alcohol Addiction
 Rehab Remanufacturing Services Ltd | Alcohol Addiction
 Greater Pollok Addiction Service   | Alcohol Addiction



db=# select orgname from users where usertype='Alcohol 
Addiction' and usertype ='Drug Addiction';
 orgname | usertype
---------+----------
(0 rows)

I would expect orgnames: 
 Greater Pollok Addiction Service, 
Rehab Remanufacturing Services Ltd 
to be returned.
Any idea where I'm going wrong?

Cheers

Paul Butler


Responses

pgsql-novice by date

Next:From: mattDate: 2002-10-17 12:46:07
Subject: unsubscribe remove
Previous:From: paul butlerDate: 2002-10-17 12:28:55
Subject: Re: char() or varchar() for frequently used column

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group