Problem using Subselect results

Поиск
Список
Период
Сортировка
От oheinz@stud.fbi.fh-darmstadt.de
Тема Problem using Subselect results
Дата
Msg-id 1058964708.3f1e84e407a8d@stud.fbi.fh-darmstadt.de
обсуждение исходный текст
Ответы Re: Problem using Subselect results  (Bruno Wolff III <bruno@wolff.to>)
Re: Problem using Subselect results  (Josh Berkus <josh@agliodbs.com>)
Список pgsql-sql
I want to use the result of a subselect as condition of another one.

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;

does return "relation my_ab unknown". it is not just a problem of execution 
order - if i turn it the other way round it's still the same.

Am I just trying to do something really stupid? And what for is the (necessary) 
AS statement for subselects, if it's not possible to access their results by 
that name?
As I need the result of a subselect  in several other subselects it's not 
possible to transform them into a cascade of sub, subsub, subsubsub.... selects.
Any ideas? 

TIA,
Oliver 


-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/


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

Предыдущее
От: Oliver Duke-Williams
Дата:
Сообщение: Can a table have a reference to itself?
Следующее
От: Trent.Mera@PeopleFirst.com
Дата:
Сообщение: PostgreSQL or pl/psSQL equivalent to MS SQL Server's xp_cmdshell?