Re: why the difference?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jakub Ouhrabka <jouh8664(at)ss1000(dot)ms(dot)mff(dot)cuni(dot)cz>
Cc: "Rajesh Kumar Mallah(dot)" <mallah(at)trade-india(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: why the difference?
Date: 2002-11-21 14:47:20
Message-ID: 11686.1037890040@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Jakub Ouhrabka <jouh8664(at)ss1000(dot)ms(dot)mff(dot)cuni(dot)cz> writes:
> the where clause is evaluated before the distinct clause, so your queries
> aren't equivalent because you switched the order by splitting the query
> into two queries...

Besides which, SELECT DISTINCT ON is order-sensitive. If you don't use
an ORDER BY with it, you are going to get rather unpredictable results.
See the example on the SELECT reference page.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Henshall, Stuart - Design & Print 2002-11-21 14:51:29 Re: help optimise this ?
Previous Message Achilleus Mantzios 2002-11-21 14:27:00 Re: [SQL] psql on FreeBSD 4.7-RELEASE-p2 and greek (iso8859-7) chars