[GENERAL] Question re 2 aggregates from 1 query

2009-06-18 Thread Scott Ribe
Assume a simple many-to-one between 2 tables: create table docs (id int8 primary key, timestamp imported_when); create table pages (id int8 primary key, doc_id int8 not null references docs); It's easy to get a count of docs imported by date: select imported_when::date, count(1) from docs

Re: [GENERAL] Question re 2 aggregates from 1 query

2009-06-18 Thread Scott Ribe
Yes, obviously that should have been sum(numpgs) in the select list of the last query... Question remains the same... -- Scott Ribe scott_r...@killerbytes.com http://www.killerbytes.com/ (303) 722-0567 voice -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes

Re: [GENERAL] Question re 2 aggregates from 1 query

2009-06-18 Thread Chris Spotts
> > Is there any way to get count of docs & pages imported by date without > resorting to selecting from a select: [Spotts, Christopher] If I understand you correctly..? create table docs (id int8 primary key, imported_when timestamp ); create table pages (id int8 primary key, doc_id int8 not

Re: [GENERAL] Question re 2 aggregates from 1 query

2009-06-18 Thread Scott Ribe
> If I understand you correctly..? Yes, exactly! I think I was suffering from a flashback to a very old DBMS that didn't support that use of distinct... -- Scott Ribe scott_r...@killerbytes.com http://www.killerbytes.com/ (303) 722-0567 voice -- Sent via pgsql-general mailing list (pgsql-gen