Re: Select Rows With Only One of Two Values

Поиск
Список
Период
Сортировка
От Chris Angelico
Тема Re: Select Rows With Only One of Two Values
Дата
Msg-id CAPTjJmrb=KZmy-CWi8QzQgakD54RWa2+ZWcNbcw_KHJbmSFrXQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Select Rows With Only One of Two Values  (Alban Hertroys <haramrae@gmail.com>)
Список pgsql-general
On Sat, Jul 21, 2012 at 6:52 AM, Alban Hertroys <haramrae@gmail.com> wrote:
> I don't think the DISTINCT is necessary there, doesn't EXCEPT already return a distinct set, just like UNION (hence
theexistence of UNION ALL)? 
>
> It can also be written as a correlated subquery:

Oops, yes. I usually use UNION ALL and friends, and IMHO that "ALL"
keyword is one of SQL's weirder warts. Most of the time, a wordier
query involves more work (SELECT DISTINCT vs SELECT), but in this odd
instance, it's the other way around.

And yes, it can. Not sure whether the subquery or EXCEPT notation is
more readable. Much of a muchness, really.

ChrisA

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

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: big database resulting in small dump
Следующее
От: Chris Angelico
Дата:
Сообщение: Re: Pg_ctl promote -- wait for slave to be promoted fully ?