Re: missing FROM-clause notice but nothing is missing ... - Mailing list pgsql-general

From Hadley Willan
Subject Re: missing FROM-clause notice but nothing is missing ...
Date
Msg-id 3E83E5AA.30008@deeperdesign.co.nz
Whole thread Raw
In response to Re: missing FROM-clause notice but nothing is missing ...  (Jean-Christian Imbeault <jc@mega-bucks.co.jp>)
List pgsql-general
Jean-Christian Imbeault wrote:

> No go with the view ... same error:
>
> DB=# SELECT products.id
>      FROM products
>      WHERE name ILIKE 'AA'
>
>      UNION
>
>      SELECT prod_id
>      FROM v_products_cast_crews
>      WHERE cast_crew=1012
>
>      ORDER BY products.id;
>
> NOTICE:  Adding missing FROM-clause entry for table "products"
> ERROR:  ORDER BY on a UNION/INTERSECT/EXCEPT result must be on one of
> the result columns
>
Strange, I actually quickly whipped up the tables and it worked for me?
You did adjust some of the column names appropriately?
Also, the LEFT JOIN's are best treated as a single line too.

Anyway, I looked further in and I see you've got it working.

Still, views are a more convenient way than doing manual UNIONs all the
time.

H


pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: missing FROM-clause notice but nothing is missing ...
Next
From: Ezra
Date:
Subject: DOES THE UNDERSCORE(_) WILD CARD EXISTS IN POSTGRESQL