select syntax question

From: Wei Weng <wweng(at)kencast(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: select syntax question
Date: 2002-11-01 21:33:32
Message-ID: 1036186412.25294.2.camel@Monet
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Bruno Wolff III 2002-11-01 21:59:00 Re: select syntax question
Previous Message Ross J. Reedstrom 2002-11-01 21:27:28 Re: unnecessary updates