Received: from sss.sss.pgh.pa.us (sss.pgh.pa.us [209.114.166.2] (may be forged)) by hub.org (8.9.3/8.9.3) with ESMTP id RAA24227; Sat, 10 Jul 1999 17:19:43 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.sss.pgh.pa.us (8.9.1/8.9.1) with ESMTP id RAA05709; Sat, 10 Jul 1999 17:18:28 -0400 (EDT) To: Oleg Bartunov cc: hackers@postgreSQL.org, pgsql-sql@postgreSQL.org Subject: Re: [HACKERS] SELECT DISTINCT question In-reply-to: Your message of Sun, 11 Jul 1999 00:16:39 +0400 (MSD) Date: Sat, 10 Jul 1999 17:18:28 -0400 Message-ID: <5707.931641508@sss.pgh.pa.us> From: Tom Lane Oleg Bartunov writes: > discovery=> select distinct on date,bytes from access_log; > ERROR: parser: parse error at or near "," The syntax for SELECT DISTINCT ON is just as brain-damaged as the functionality itself: there's no comma after the column name. You want select distinct on date date,bytes from access_log; The reason the functionality is brain-damaged is that there's no way to know which tuple out of the set of tuples with a given "date" value will be the one returned. SELECT DISTINCT ON is not in SQL92, and I think it shouldn't be in Postgres either... regards, tom lane