Re: problem with query and group by error

Поиск
Список
Период
Сортировка
От Susan Cassidy
Тема Re: problem with query and group by error
Дата
Msg-id CAE3Q8om2L1R+KtSfiV7duPUY9OcJU+arSoTEBycgZTxa2a6tOQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: problem with query and group by error  (Scott Marlowe <scott.marlowe@gmail.com>)
Ответы Re: problem with query and group by error  (David Johnston <polobo@yahoo.com>)
Список pgsql-general
I tried distinct on srs.scan_run_id, which is a primary key, and got an error, but I tried it again just now, and it worked fine.

Thanks for having me try it again.

I had ended up with
   group by srs.scan_run_id, sty.scan_type, ssn.scan_system_name, ssn.simulation, ssitenames.scan_site_name,
   ssitenames.scan_site_name, ssitenicknames.scan_site_nickname,
   hvhi.hardware_version_or_hardware_identifier_name, sv.software_version, sc.description

because I kept adding column names that I got errors on, but this is by no means the whole list.  So, I'm still confused as to why I got the error in the first place.

Someone said something about
 "Yes, except those that are inside the aggregate."
but I don't have an aggregate specified.

Susan



On Fri, Feb 21, 2014 at 10:38 AM, Scott Marlowe <scott.marlowe@gmail.com> wrote:
On Fri, Feb 21, 2014 at 10:40 AM, Susan Cassidy
<susan.cassidy@decisionsciencescorp.com> wrote:
>
> I originally had the query without the group by, but I had duplicate rows,
> so I added a group by to eliminate them.


Have you tried select distinct or select distinct on ()?

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

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: problem with query and group by error
Следующее
От: David Johnston
Дата:
Сообщение: Re: problem with query and group by error