select syntax question - Mailing list pgsql-sql

From Wei Weng
Subject select syntax question
Date
Msg-id 1036186412.25294.2.camel@Monet
Whole thread Raw
Responses Re: select syntax question  (Bruno Wolff III <bruno@wolff.to>)
Re: select syntax question  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-sql
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.




pgsql-sql by date:

Previous
From: "Ross J. Reedstrom"
Date:
Subject: Re: unnecessary updates
Next
From: Bruno Wolff III
Date:
Subject: Re: select syntax question