Received: from falla.videotron.net (falla.videotron.net [205.151.222.106]) by hub.org (8.10.1/8.10.1) with ESMTP id e5FLEbI98377 for ; Thu, 15 Jun 2000 17:14:37 -0400 (EDT) Received: from modemcable079.96-200-24.mtl.mc.videotron.net ([24.200.96.79]) by falla.videotron.net (Sun Internet Mail Server sims.3.5.1999.12.14.10.29.p8) with SMTP id <0FW700AA2LRORX@falla.videotron.net> for pgsql-sql@postgresql.org; Thu, 15 Jun 2000 14:52:36 -0400 (EDT) Date: Thu, 15 Jun 2000 20:10:36 +0000 (GMT) From: Patrick Coulombe Subject: find the number of rows for each table To: pgsql-sql@postgresql.org Message-id: <20000615.20103600@modemcable079.96-200-24.mtl.mc.videotron.net> MIME-version: 1.0 X-Mailer: Mozilla/3.0 (compatible; StarOffice/5.1; Linux) Content-type: text/plain; charset=ISO-8859-1 X-Priority: 3 (Normal) Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by hub.org id e5FLEcI98378 X-Archive-Number: 200006/157 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