RE: Sequential select queries...?? - Mailing list pgsql-sql

From Robby Slaughter
Subject RE: Sequential select queries...??
Date
Msg-id EPEHLKLEHAHLONFOKNHNGEPKDEAA.webmaster@robbyslaughter.com
Whole thread Raw
In response to Sequential select queries...??  (Mark Mikulec <mm98au@badger.ac.brocku.ca>)
List 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


pgsql-sql by date:

Previous
From: "Josh Berkus"
Date:
Subject: Re: SQL Statement too long
Next
From: "Josh Berkus"
Date:
Subject: Re: Sequential select queries...??