Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id B1698476E8D for ; Fri, 1 Nov 2002 16:33:32 -0500 (EST) Received: from mta4.snet.net (mta4.snet.net [204.60.203.76]) by postgresql.org (Postfix) with ESMTP id 2D768476E8C for ; Fri, 1 Nov 2002 16:33:32 -0500 (EST) Received: from pop.snet.net ([204.60.203.73]) by mta4.snet.net (8.12.3/8.12.3/SNET-mx-1.2/D-1.1.1.1/O-1.1.1.1) with ESMTP id gA1LX8Um006243 for ; Fri, 1 Nov 2002 16:33:08 -0500 (EST) X-Originating-IP: [64.252.95.167] X-SBCIS-MTA: [pop.snet.net] Received: from [192.168.1.83] (167.95.252.64.snet.net [64.252.95.167]) by pop.snet.net (8.12.3/8.12.3/SNET-pop-1.2/D-1.1.1.1/O-1.1.1.1) with ESMTP id gA1LXNH8014645 for ; Fri, 1 Nov 2002 16:33:23 -0500 (EST) Subject: select syntax question From: Wei Weng To: pgsql-sql@postgresql.org Content-Type: text/plain Organization: Message-Id: <1036186412.25294.2.camel@Monet> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.1.90 (Preview Release) Date: 01 Nov 2002 16:33:32 -0500 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/20 X-Sequence-Number: 10162 This is what is on postgresql's manual page: http://www.postgresql.org/idocs/index.php?sql-select.html SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ] * | expression [ AS output_name ] [, ...] [ FROM from_item [, ...] ] [ WHERE condition ] [ GROUP BY expression [, ...] ] [ HAVING condition [, ...] ] [ { UNION | INTERSECT | EXCEPT } [ ALL ] select ] [ ORDER BY expression [ ASC | DESC | USING operator ] [, ...] ] [ FOR UPDATE [ OF tablename [, ...] ] ] [ LIMIT { count | ALL } ] [ OFFSET start ] According to this syntax, SELECT DISTINCT COUNT(ID) FROM test should be valid while SELECT COUNT(DISTINCT ID) FROM test otherwise. while in fact, both are valid. Is there any difference between this two queries? Thanks! -- Wei Weng Network Software Engineer KenCast Inc.