From: Hannu Krosing <hannu@trust.ee>
To: Oleg Bartunov <oleg@sai.msu.su>
Cc: hackers@postgreSQL.org
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [HACKERS] SELECT DISTINCT question
Date: Tue, 13 Jul 1999 23:50:57 +0300
Message-ID: <378BA6B1.2B226DDB@trust.ee> (raw)
References: <Pine.GSO.3.96.SK.990711000908.2043R-100000@ra>
Oleg Bartunov wrote:
>
> I got a problem with query:
>
> select distinct (date), bytes from access_log;
>
> which works but not as I expect. I thought this query will select
> all rows with distinct values of 'date' column, but it get
> distinct pairs 'date, bytes' . From documnetation I see
>
> "DISTINCT will eliminate all duplicate rows from the selection.
> DISTINCT ON column will eliminate all duplicates in the specified column;
> this is equivalent to using GROUP BY column.
If it is equivalent to GROUP BY then it should allow only aggregates
in non-distinct columns, like:
select distinct on date date, sum(bytes) from access_log;
If it does not, then it should be files as a bug imho.
-----------------
Hannu
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: hannu@trust.ee, oleg@sai.msu.su, hackers@postgreSQL.org
Subject: Re: [HACKERS] SELECT DISTINCT question
In-Reply-To: <378BA6B1.2B226DDB@trust.ee>
References: <Pine.GSO.3.96.SK.990711000908.2043R-100000@ra> <378BA6B1.2B226DDB@trust.ee>
* 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