pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chris Bitmead <chris.bitmead@bigfoot.com>
To: pgsql-sql@hub.org
Subject: Re: [SQL] Slashdot Query
Date: Sat, 05 Jun 1999 02:10:22 +1000
Message-ID: <3757FA6E.1363F3B8@bigfoot.com> (raw)
References: <16847.928506113@sss.pgh.pa.us>

Tom Lane wrote:

> It is not real clear what the correct behavior is, which is why
> nothing's been done about it; we've gone round on the issue a couple
> of times (see the pghackers archives).  My own thought is that the
> query as given above should be illegal, since there is no unique
> value of datetime to go with a "distinct" set of oid, title, image.

Are yes I remember the issues now. I guess it would be nice if there was
some clause to specify which to elminate. Like SELECT DISTINCT
ELIMINATING LAST which then uses the ORDER BY clause to decide whether
to eliminate the first or last. But I can see that would be fiddly to
implement.

> 
> You might consider using GROUP BY rather than DISTINCT if you want
> to order the results in a particular way, say
>         SELECT oid, title, image ...
>                 GROUP BY oid, title, image ORDER BY min(datetime)

I'll give it a go.

> where you use an aggregate like min or max to resolve the ambiguity
> about which datetime to associate with a particular group...
> 
>                         regards, tom lane

-- 
Chris Bitmead
http://www.bigfoot.com/~chris.bitmead
mailto:chris.bitmead@bigfoot.com



view thread (7+ messages)  latest in thread

Message-ID: <3757FA6E.1363F3B8@bigfoot.com>
Permalink:  ../3757FA6E.1363F3B8@bigfoot.com/
Also on:    postgresql.org/message-id/3757FA6E.1363F3B8@bigfoot.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: chris.bitmead@bigfoot.com, pgsql-sql@hub.org
  Subject: Re: [SQL] Slashdot Query
  In-Reply-To: <3757FA6E.1363F3B8@bigfoot.com>
  References: <16847.928506113@sss.pgh.pa.us> <3757FA6E.1363F3B8@bigfoot.com>

* 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