| From: | Oleg Bartunov <oleg(at)sai(dot)msu(dot)su> |
|---|---|
| To: | hackers(at)postgreSQL(dot)org |
| Cc: | pgsql-sql(at)postgreSQL(dot)org |
| Subject: | SELECT DISTINCT question |
| Date: | 1999-07-10 20:16:39 |
| Message-ID: | Pine.GSO.3.96.SK.990711000908.2043R-100000@ra |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers pgsql-sql |
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(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Oleg Bartunov | 1999-07-10 20:44:02 | Re: [HACKERS] 6.5.1 |
| Previous Message | Oleg Bartunov | 1999-07-10 20:09:02 |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 1999-07-10 21:18:28 | Re: [HACKERS] SELECT DISTINCT question |
| Previous Message | Tom Lane | 1999-07-10 20:03:17 | Re: [SQL] Oddities with NULL and GROUP BY |