Re: UNION and LIMIT issue

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: UNION and LIMIT issue
Дата
Msg-id 10865.1184884079@sss.pgh.pa.us
обсуждение исходный текст
Ответ на UNION and LIMIT issue  (Howard Smith <hsmith@visualmining.com>)
Список pgsql-sql
Howard Smith <hsmith@visualmining.com> writes:
>       SELECT name,quantity FROM fruit limit 3
>       UNION
>                select name,CAST(SUM(quantity) as integer) from (
>               select Cast('Other' as varchar) as name,quantity from fruit
>               limit ALL offset 3
>        ) w   group by name

You need parentheses:
(SELECT ... limit 3) UNION ...

ISTM that a LIMIT without an ORDER BY is a pretty bad idea, btw.
        regards, tom lane


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

Предыдущее
От: Howard Smith
Дата:
Сообщение: UNION and LIMIT issue
Следующее
От: ljb
Дата:
Сообщение: Re: UNION and LIMIT issue