Re: a wierd query

From: Christoph Haller <ch(at)rodos(dot)fzk(dot)de>
To: s(dot)vanroye(at)farcourier(dot)com (Stijn Vanroye)
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: a wierd query
Date: 2004-05-19 10:55:22
Message-ID: 200405190855.KAA02721@rodos
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Dan Field 2004-05-19 11:33:22 Re: Very slow search using basic pattern matching
Previous Message Benoît BOURNON 2004-05-19 10:24:19 Re: Replace function ...