Re: Column "..." does not exist (view + union)
От | Andreas Kretschmer |
---|---|
Тема | Re: Column "..." does not exist (view + union) |
Дата | |
Msg-id | 20111217090246.GA12209@tux обсуждение исходный текст |
Ответ на | Column "..." does not exist (view + union) (Stefan Weiss <krewecherl@gmail.com>) |
Ответы |
Re: Column "..." does not exist (view + union)
|
Список | pgsql-sql |
Stefan Weiss <krewecherl@gmail.com> wrote: > > - running this query - > > 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". Rewrite your query to something like: select name from (select name, ctype from ... union select name, ctype from ...) foo order by ctype Andreas -- Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect. (Linus Torvalds) "If I was god, I would recompile penguin with --enable-fly." (unknown) Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°
В списке pgsql-sql по дате отправления: