RE: Sequential select queries...??

Поиск
Список
Период
Сортировка
От Robby Slaughter
Тема RE: Sequential select queries...??
Дата
Msg-id EPEHLKLEHAHLONFOKNHNGEPKDEAA.webmaster@robbyslaughter.com
обсуждение исходный текст
Ответ на Sequential select queries...??  (Mark Mikulec <mm98au@badger.ac.brocku.ca>)
Список 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 по дате отправления:

Предыдущее
От: "Josh Berkus"
Дата:
Сообщение: Re: SQL Statement too long
Следующее
От: "Josh Berkus"
Дата:
Сообщение: Re: Sequential select queries...??