On Wed, Jul 23, 2003 at 14:51:48 +0200,
  [EMAIL PROTECTED] 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;

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faqs/FAQ.html

Reply via email to