At 03:51 PM 7/31/2008, Tom Lane wrote:
Steve Midgley <[EMAIL PROTECTED]> writes:
> At 07:29 AM 7/16/2008, Tom Lane wrote:
>> I think what is happening is that ORDER BY knows that and gets rid
of
>> the duplicate entries while DISTINCT ON fails to do so.
> Of course removing the duplicate from
Steve Midgley <[EMAIL PROTECTED]> writes:
> At 07:29 AM 7/16/2008, Tom Lane wrote:
>> I think what is happening is that ORDER BY knows that and gets rid of
>> the duplicate entries while DISTINCT ON fails to do so.
> Of course removing the duplicate from both areas is the correct
> solution and I
At 07:29 AM 7/16/2008, Tom Lane wrote:
Steve Midgley <[EMAIL PROTECTED]> writes:
Interesting. You realize of course that sorting by the same
expression
twice is completely redundant? I haven't dug through the code yet but
Thanks Tom. Yeah, I was a little embarrassed to throw this code up on
Steve Midgley <[EMAIL PROTECTED]> writes:
> SELECT DISTINCT ON
> ("property"."state",
> CASE WHEN ("search_rate_max" IS NOT NULL) THEN 1 ELSE 2
> END,"search_rate_max",
> CASE WHEN ("search_rate_max" IS NOT NULL) THEN 1 ELSE 2
> END,"search_rate_max",
> property.id)
> property.id
> FROM p
Hi,
I'm a little baffled. I'm trying to generate a SQL statement that
issues a DISTINCT ON using the same values as my ORDER BY statement.
I'm using a somewhat complex CASE statement in my ORDER BY clause. I'm
on Pg 8.2. Here is some SQL to get you started at seeing my problem:
-