Re: Column "..." does not exist (view + union)
От | Stefan Weiss |
---|---|
Тема | Re: Column "..." does not exist (view + union) |
Дата | |
Msg-id | 4EECA699.2020700@gmail.com обсуждение исходный текст |
Ответ на | Re: Column "..." does not exist (view + union) (Andreas Kretschmer <akretschmer@spamfence.net>) |
Ответы |
Re: Column "..." does not exist (view + union)
|
Список | pgsql-sql |
On 2011-12-17 10:02, Andreas Kretschmer wrote: > Stefan Weiss <krewecherl@gmail.com> wrote: >> >> SELECT name >> FROM dossier_contact_v >> WHERE dossier_id = 56993 >> AND ctype = 234 >> UNION >> SELECT name >> FROM dossier_contact_v >> WHERE dossier_id = -1 >> AND ctype = -1 >> ORDER BY ctype; >> >> - fails with the following error message: >> >> ERROR: column "ctype" does not exist >> LINE 10: ORDER BY ctype; > > The reult table doesn't contain a column "ctype", it contains only > "name". [...] 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. Thanks, that explains it. - stefan
В списке pgsql-sql по дате отправления: