Re: UNION question

Поиск
Список
Период
Сортировка
От 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 по дате отправления:

Предыдущее
От: "Hartman, Matthew"
Дата:
Сообщение: Re: UNION question
Следующее
От: Brandon Metcalf
Дата:
Сообщение: Re: UNION question