where clause question

Поиск
Список
Период
Сортировка
От Scott Frankel
Тема where clause question
Дата
Msg-id 2C1525F6-4E80-4A62-8C87-59A9F1CD3BCD@pacbell.net
обсуждение исходный текст
Ответы Re: where clause question
Re: where clause question
Re: where clause question
Список pgsql-general
Hello,

Is it possible to perform selects in a where clause of a statement?

Given a statement as follows:

     SELECT foo.foo_id, foo.name
     FROM foo, bar
     WHERE foo.bar_id = bar.bar_id
     AND bar.name = 'martini';

I'm looking for a way to recast it so that the select and from clauses
refer to a single table and the join referencing the second table
occurs in the where clause.  For example, something like this:

     SELECT foo.foo_id, foo.name
     FROM foo
     WHERE (SELECT * FROM foo, bar WHERE ...)
     foo.bar_id = bar.bar_id
     AND bar.name = 'martini';

I've explored the "where exists" clause, but it's not supported by the
application toolkit I'm using.  AFAIK, I've only got access to where ...

Thanks in advance!
Scott



В списке pgsql-general по дате отправления:

Предыдущее
От: hubert depesz lubaczewski
Дата:
Сообщение: Re: strange error occurs when adding index
Следующее
От: Dimitri Fontaine
Дата:
Сообщение: Re: PL/Perl 64-bit and sending emails