Re: [GENERAL] problem with query and group by error

2014-02-21 Thread David Johnston
Susan Cassidy-3 wrote > Someone said something about > "Yes, except those that are inside the aggregate." > but I don't have an aggregate specified. So every column then... As soon as you add "group by" the rule becomes - every column is either a group determinate or is aggregated. If you simpl

Re: [GENERAL] problem with query and group by error

2014-02-21 Thread Susan Cassidy
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,

Re: [GENERAL] problem with query and group by error

2014-02-21 Thread Scott Marlowe
On Fri, Feb 21, 2014 at 10:40 AM, Susan Cassidy 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 ()? -- Sent via pgsql-general mailing list (pgsql-general@postg

Re: [GENERAL] problem with query and group by error

2014-02-21 Thread Emanuel Calvo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 El 21/02/14 14:40, Susan Cassidy escribió: > I have a large query: SELECT distinct on (srs.scan_run_id) > srs.scan_run_id, srs.run_request_number, srs.container_id, > srs.manifest_id, srs.scan_system_name_id, srs.scan_site_name_id, > srs.scan_site_

Re: [GENERAL] problem with query and group by error

2014-02-21 Thread David Johnston
Susan Cassidy-3 wrote > I have a large query: >SELECT distinct on (srs.scan_run_id) srs.scan_run_id, > srs.run_request_number, srs.container_id, srs.manifest_id, > srs.scan_system_name_id, >srs.scan_site_name_id, srs.scan_site_nickname_id, > to_char(srs.start_time, 'MM/DD/YY HH24:MI:SS'

[GENERAL] problem with query and group by error

2014-02-21 Thread Susan Cassidy
I have a large query: SELECT distinct on (srs.scan_run_id) srs.scan_run_id, srs.run_request_number, srs.container_id, srs.manifest_id, srs.scan_system_name_id, srs.scan_site_name_id, srs.scan_site_nickname_id, to_char(srs.start_time, 'MM/DD/YY HH24:MI:SS'), to_char(srs.stop_time, '