Search Postgresql Archives

Re: Select Rows With Only One of Two Values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jul 21, 2012 at 6:52 AM, Alban Hertroys <haramrae@xxxxxxxxx> wrote:
> I don't think the DISTINCT is necessary there, doesn't EXCEPT already return a distinct set, just like UNION (hence the existence 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

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux