group by

Поиск
Список
Период
Сортировка
От tjk@tksoft.com
Тема group by
Дата
Msg-id 199912050349.TAA01753@uno.tksoft.com
обсуждение исходный текст
Ответы Re: [SQL] group by  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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

В списке pgsql-sql по дате отправления:

Предыдущее
От:
Дата:
Сообщение: Re: [SQL] Postgres Date/Time Special Constants
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [SQL] group by