From: | Patrick Coulombe <pcoulombe(at)mediacces(dot)com> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | find the number of rows for each table |
Date: | 2000-06-15 20:10:36 |
Message-ID: | 20000615.20103600@modemcable079.96-200-24.mtl.mc.videotron.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hi,
I want to find the number of rows for each table (2) in 1 query,
the query is:
select distinct * from medias, contacts WHERE medias.media_id =
contacts.media_id AND medias_categories.media_id = medias.media_id AND
medias_categories.categorie_id = 1
--------
700 rows
If I want to find the number of row for medias (for the same query) I
have to do a other query :
select distinct * from medias WHERE medias.media_id =
contacts.media_id AND medias_categories.media_id = medias.media_id AND
medias_categories.categorie_id = 1
--------
60 rows
I search for a solution, I try that :
select distinct *, count(distinct (medias.media_id)), count(distinct
(contacts.contact_id)) from medias, contacts WHERE medias.media_id =
contacts.media_id AND medias_categories.media_id = medias.media_id AND
medias_categories.categorie_id = 1
-------------------------------------------------
ERROR: parser: parse error at or near "distinct"
don't work, as you can see.
I need help, please.
Patrick
From | Date | Subject | |
---|---|---|---|
Next Message | Karel Zak | 2000-06-15 21:16:00 | Re: ANNOUNCE: pg_dumplo 0.0.5 |
Previous Message | Stephan Szabo | 2000-06-15 19:09:39 | Re: Re: Simple search question |