From: Jackson, DeJuan <djackson@cpsgroup.com>
To: pierre@desertmoon.com
To: pgsql-sql@postgreSQL.org
Subject: RE: [SQL] How do I do this queyr?
Date: Thu, 25 Feb 1999 16:09:17 -0600
Message-ID: <F10BB1FAF801D111829B0060971D839F6B4790@cpsmail> (raw)
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@desertmoon.com [mailto:pierre@desertmoon.com]
> Sent: Thursday, February 25, 1999 2:42 PM
> To: pgsql-sql@postgreSQL.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
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: djackson@cpsgroup.com, pierre@desertmoon.com
Subject: Re: [SQL] How do I do this queyr?
In-Reply-To: <F10BB1FAF801D111829B0060971D839F6B4790@cpsmail>
References: <F10BB1FAF801D111829B0060971D839F6B4790@cpsmail>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox