pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedHow do I do this queyr?
2+ messages / 2 participants
[nested] [flat]
* How do I do this queyr?
@ 1999-02-25 20:41 pierre@desertmoon.com
0 siblings, 0 replies; 2+ messages in thread
From: pierre@desertmoon.com @ 1999-02-25 20:41 UTC (permalink / raw)
To: pgsql-sql
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
^ permalink raw reply [nested|flat] 2+ messages in thread
* RE: [SQL] How do I do this queyr?
@ 1999-02-25 22:09 Jackson, DeJuan <djackson@cpsgroup.com>
0 siblings, 0 replies; 2+ messages in thread
From: Jackson, DeJuan @ 1999-02-25 22:09 UTC (permalink / raw)
To: pierre@desertmoon.com; 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@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
>
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~1999-02-25 22:09 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-02-25 20:41 How do I do this queyr? pierre@desertmoon.com
1999-02-25 22:09 RE: [SQL] How do I do this queyr? Jackson, DeJuan <djackson@cpsgroup.com>
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