I wasn't sure whether EXCEPT would create a unique set from among the
results of both queries.
As in, if the first part of the query (before the EXCEPT clause),
without the DISTINCT, yielded
yahoo.com
yahoo.com
would the query reduce that to a single yahoo.com regardless of whether
it showed up in the EXCEPT clause?
-tfo
--
Thomas F. O'Connell
Co-Founder, Information Architect
Sitening, LLC
http://www.sitening.com/
110 30th Avenue North, Suite 6
Nashville, TN 37203-6320
615-260-0005
On Dec 2, 2004, at 10:26 AM, Tom Lane wrote:
> =?iso-8859-15?Q?Pierre-Fr=E9d=E9ric_Caillaud?=
> <lists@boutiquenumerique.com> writes:
>> I may be mistaken, but you may be doing the same thing twice : you're
>> basically writing :
>
>> SELECT DISTINCT X WHERE Y EXCEPT SELECT DISTINCT X WHERE NOT Y
>> Is this not a way to get an empty result set ?
>
> No, because some X values may appear in rows where Y, and also in rows
> where NOT Y.
>
> The DISTINCTs are wastes of time, though, because EXCEPT implies
> elimination of duplicates.
>
> regards, tom lane