> > 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 null references docs); INSERT INTO docs values (1,now()),(2,now()),(3,now()),(4,now()- interval '1 day'); INSERT INTO pages values (1,1),(2,1),(3,2),(4,2),(5,3),(6,4),(7,4),(8,4); select imported_when::date, count(distinct pages.id),count(distinct docs.id) from docs, pages where docs.id = pages.doc_id group by imported_when::date; -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general