"Markus Bertheau" <twanger@eudoramail.com> writes:
> Then i tried
> select partners.person_id, count(views.person_id) from partners, views where views.person_id = partners.person_id
groupby views.person_id
> but this gave very strange results which are definitely not what i wanted.
I think you mistyped, because that query will also fail:
regression=# create table views (person_id int, timestamp timestamp);
CREATE
regression=# create table partners (person_id int UNIQUE, domain text);
NOTICE: CREATE TABLE/UNIQUE will create implicit index 'partners_person_id_key' for table 'partners'
CREATE
regression=# select partners.person_id, count(views.person_id)
regression-# from partners, views where views.person_id = partners.person_id
regression-# group by views.person_id;
ERROR: Attribute partners.person_id must be GROUPed or used in an aggregate function
How about showing us what you *really* did?
regards, tom lane