Re: Column "..." does not exist (view + union)

Поиск
Список
Период
Сортировка
От Bèrto ëd Sèra
Тема Re: Column "..." does not exist (view + union)
Дата
Msg-id CAKwGa_9D9M6V+bYJwayx_JtD1Tq3oQ0vouSXSshebQ8bbiJGMg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Column "..." does not exist (view + union)  (Stefan Weiss <krewecherl@gmail.com>)
Ответы Re: Column "..." does not exist (view + union)  (Stefan Weiss <krewecherl@gmail.com>)
Список pgsql-sql
Hi,

>I see. So this has to do with the union; after combining the two
>queries, the tables from the FROM clauses are no longer available.

this has nothing to do with the UNION, but with the fact that the result set is ordered after being produced, so you can order by any of its elements, and only by that. You can actually order by calling them acording to their position in the result set, like in:

SELECT 
  relname, 
  relpages
FROM pg_class
ORDER BY 1;

where 1 is actually the first element (no matter how it's called). The table as such is never available to ORDER BY, no matter how simple your query is.

Bèrto
-- 
==============================
If Pac-Man had affected us as kids, we'd all be running around in a darkened room munching pills and listening to repetitive music.

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

Предыдущее
От: David Johnston
Дата:
Сообщение: Re: using a generated series in function
Следующее
От: Bèrto ëd Sèra
Дата:
Сообщение: Re: using a generated series in function