| От | Tom Lane |
|---|---|
| Тема | Re: UNION question |
| Дата | |
| Msg-id | 24751.1247243340@sss.pgh.pa.us обсуждение |
| Ответ на | UNION question (Brandon Metcalf <brandon@geronimoalloys.com>) |
| Ответы |
Re: UNION question
|
| Список | pgsql-general |
Brandon Metcalf <brandon@geronimoalloys.com> writes:
> I tried moving the last group of WHERE, GROUP BY, and ORDER BY before
> the UNION with the query it belongs to, but that results in a
> different syntax error.
I think that's probably what you want to do. What you're missing is
you need parentheses to put an ORDER BY into an arm of a UNION:
(SELECT ... ORDER BY ...) UNION SELECT ...
Otherwise it wants to consider the ORDER BY as applying to the UNION
output.
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера