From: | "Jackson, DeJuan" <djackson(at)cpsgroup(dot)com> |
---|---|
To: | pierre(at)desertmoon(dot)com, pgsql-sql(at)postgreSQL(dot)org |
Subject: | RE: [SQL] How do I do this queyr? |
Date: | 1999-02-25 22:09:17 |
Message-ID: | F10BB1FAF801D111829B0060971D839F6B4790@cpsmail |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
try:
SELECT id FROM mytable t1
WHERE keyword='abc' AND
EXISTS(SELECT 1 FROM mytable t2
WHERE keyword ='def' AND t1.id = t2.id);
-DEJ
> -----Original Message-----
> From: pierre(at)desertmoon(dot)com [mailto:pierre(at)desertmoon(dot)com]
> Sent: Thursday, February 25, 1999 2:42 PM
> To: pgsql-sql(at)postgreSQL(dot)org
> Subject: [SQL] How do I do this queyr?
>
>
> All,
> Given a table of keywords. How would I grab the distinct
> id's that have
> both keywords attached to it. Example:
>
> ID | Keyword
> -------------
> 1 | abc
> 2 | abc
> 3 | def
> 1 | def
>
> We want all the id's that have BOTH abc AND def as
> keywords. I think I may
> be having a brain freeze here...it seems obvious but I just
> can't seem
> to get my brain to spit up the answer. :( Too much caffiene?
>
> Thanks for the help!
>
> -=pierre
>
From | Date | Subject | |
---|---|---|---|
Next Message | Clark Evans | 1999-02-26 00:55:12 | OID Behavior |
Previous Message | Mark A. Schwenk | 1999-02-25 22:08:28 |