Received: from bjke.com (firewall-user@ganymede.bjke.com [144.210.8.38]) by hub.org (8.9.2/8.9.1) with ESMTP id RAA44341 for ; Thu, 25 Feb 1999 17:07:14 -0500 (EST) (envelope-from djackson@cpsgroup.com) Received: by bjke.com; id QAA13999; Thu, 25 Feb 1999 16:07:09 -0600 (CST) Received: from cpsmail.cpsgroup.com(144.210.12.11) by gauntlet.bjke.com via smap (4.1) id xmaa13621; Thu, 25 Feb 99 16:06:45 -0600 Received: by cpsmail with Internet Mail Service (5.0.1458.49) id ; Thu, 25 Feb 1999 16:09:19 -0600 Message-ID: From: "Jackson, DeJuan" To: pierre@desertmoon.com, pgsql-sql@postgreSQL.org Subject: RE: [SQL] How do I do this queyr? Date: Thu, 25 Feb 1999 16:09:17 -0600 X-Priority: 3 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.0.1458.49) Content-Type: text/plain 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 >