Re: Problem using Subselect results

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: Problem using Subselect results
Дата
Msg-id 20030728164129.GA25693@wolff.to
обсуждение исходный текст
Ответ на Problem using Subselect results  (oheinz@stud.fbi.fh-darmstadt.de)
Список pgsql-sql
On Wed, Jul 23, 2003 at 14:51:48 +0200, oheinz@stud.fbi.fh-darmstadt.de wrote:
> I want to use the result of a subselect as condition of another one.

The two selects you use ar both from items at the same level and hence can't
reference one another. In your example below you could just use a join.

> CREATE VIEW my_view AS SELECT b,c
> (SELECT a, b FROM table2 WHERE b=1) my_ab,
> (SELECT  c FROM table3, my_ab WHERE table3.a=my_ab.a) my_c;

Something like:

CREATE VIEW my_view AS SELECT table2.b, table3.c   from table2, table3   where     table2.b = 1 and     table2.a =
table3.a;


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Using a compound primary key
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Very strange 'now' behaviour in nested triggers.