Received: from ra.sai.msu.su (ra.sai.msu.su [158.250.29.2]) by hub.org (8.9.3/8.9.3) with ESMTP id QAA13055; Sat, 10 Jul 1999 16:16:42 -0400 (EDT) (envelope-from oleg@sai.msu.su) Received: from ra (ra [158.250.29.2]) by ra.sai.msu.su (8.9.1/8.9.1) with SMTP id AAA06017; Sun, 11 Jul 1999 00:16:40 +0400 (MSD) Date: Sun, 11 Jul 1999 00:16:39 +0400 (MSD) From: Oleg Bartunov X-Sender: megera@ra Reply-To: Oleg Bartunov To: hackers@postgreSQL.org cc: pgsql-sql@postgreSQL.org Subject: SELECT DISTINCT question Message-ID: Organization: Sternberg Astronomical Institute (Moscow University) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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