Re: problem with query and group by error

From: Susan Cassidy <susan(dot)cassidy(at)decisionsciencescorp(dot)com>
To: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: problem with query and group by error
Date: 2014-02-21 19:15:45
Message-ID: CAE3Q8om2L1R+KtSfiV7duPUY9OcJU+arSoTEBycgZTxa2a6tOQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)marlowe(at)gmail(dot)com>wrote:

> On Fri, Feb 21, 2014 at 10:40 AM, Susan Cassidy
> <susan(dot)cassidy(at)decisionsciencescorp(dot)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 ()?
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Johnston 2014-02-21 19:34:37 Re: problem with query and group by error
Previous Message Scott Marlowe 2014-02-21 18:38:12 Re: problem with query and group by error