From: Oleg Bartunov <oleg@sai.msu.su>
To: hackers@postgreSQL.org
Cc: pgsql-sql@postgreSQL.org
Subject: SELECT DISTINCT question
Date: Sun, 11 Jul 1999 00:16:39 +0400 (MSD)
Message-ID: <Pine.GSO.3.96.SK.990711000908.2043R-100000@ra> (raw)
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.
ALL will return all candidate rows, including duplicates."
discovery=> select distinct on date,bytes from access_log;
ERROR: parser: parse error at or near ","
Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83
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: oleg@sai.msu.su, hackers@postgreSQL.org
Subject: Re: SELECT DISTINCT question
In-Reply-To: <Pine.GSO.3.96.SK.990711000908.2043R-100000@ra>
References: <Pine.GSO.3.96.SK.990711000908.2043R-100000@ra>
* 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