From: | "Robby Slaughter" <webmaster(at)robbyslaughter(dot)com> |
---|---|
To: | "Mark Mikulec" <mm98au(at)badger(dot)ac(dot)brocku(dot)ca>, <pgsql-sql(at)postgresql(dot)org> |
Subject: | RE: Sequential select queries...?? |
Date: | 2001-08-20 16:35:00 |
Message-ID: | EPEHLKLEHAHLONFOKNHNGEPKDEAA.webmaster@robbyslaughter.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
>Hello,
>At first I thought what I was trying to do was simple and could be done
>easily - but alas, I've spent way too much time and could not figure out
>how to get the results in question.
I think there's cause for excitement, because unless I'm interpreting you
incorrectly, it IS easy to do what you want to do:
Use the UNION functionality. If your table T is this
id name description
-------------------------
1 abc def
2 bcd abc
3 def ghi
4 jkl bcd
5 hij hij
And you do this:
SELECT id FROM T WHERE name = 'abc'
UNION
SELECT id FROM T WHERE desc = 'abc';
You'll get:
id
----
1
2
That ought to do it for you!
Hope this helps,
Robby Slaughter
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2001-08-20 16:39:42 | Re: Sequential select queries...?? |
Previous Message | Josh Berkus | 2001-08-20 16:34:28 | Re: SQL Statement too long |