group by

From: "tjk(at)tksoft(dot)com" <tjk(at)tksoft(dot)com>
To: pgsql-sql(at)postgreSQL(dot)org
Subject: group by
Date: 1999-12-05 03:49:29
Message-ID: 199912050349.TAA01753@uno.tksoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Is there something amiss with the "GROUP BY" clause?

I never had any problems with it, but I was just doing
a query trying to eliminate duplicates from a list
using GROUP BY on one of the fields, and I got
an "Illegal use of aggregates or non-group column in target list"
error.

E.g. "select email,username from emails group by email"
produces the error.
"select email from emails group by email"
works, and so does
"select distinct on email email,username from emails"

My PG version is 6.5.3.

"distinct on columnname" works and does the job, but
I am curious if I am brainfarting or if this is a
real change.

Thanks,

Troy

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 1999-12-05 05:47:00 Re: [SQL] group by
Previous Message kaiq 1999-12-05 01:49:19 Re: [SQL] Postgres Date/Time Special Constants