pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christoph Haller <ch@rodos.fzk.de>
To: s.vanroye@farcourier.com
Cc: pgsql-sql@postgresql.org
Subject: Re: a wierd query
Date: Wed, 19 May 2004 10:55:22 METDST
Message-ID: <200405190855.KAA02721@rodos> (raw)
In-Reply-To: <71E201BE5E881C46811BA160694C5FCB046739@fs1000.farcourier.com>

> 
>     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 




view thread (16+ messages)  latest in thread

Message-ID: <200405190855.KAA02721@rodos>
Permalink:  ../200405190855.KAA02721@rodos/
Also on:    postgresql.org/message-id/200405190855.KAA02721@rodos

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: ch@rodos.fzk.de, s.vanroye@farcourier.com
  Subject: Re: a wierd query
  In-Reply-To: <200405190855.KAA02721@rodos>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox