Re: a wierd query - Mailing list pgsql-sql

From Christoph Haller
Subject Re: a wierd query
Date
Msg-id 200405190855.KAA02721@rodos
Whole thread Raw
In response to Re: a wierd query  ("Stijn Vanroye" <s.vanroye@farcourier.com>)
List pgsql-sql
> 
>     select distinct on (date, employee_id) employee_id, date from
>     (
>       select distinct on (begindate, employee_id) begindate as date, employ=
> ee_id from workhour
>       UNION
>       select distinct on (enddate, employee_id) enddate as date, employee_i=
> d from workhour
>     )as dist
> 
> 
Just as a side note 
If you don't use ORDER BY when using DISTINCT ON 
you'll have unpredictable results. 

Regards, Christoph 



pgsql-sql by date:

Previous
From: Richard Huxton
Date:
Subject: Using "Without OIDs"
Next
From: Dan Field
Date:
Subject: Re: Very slow search using basic pattern matching