pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Wei Weng <wweng@kencast.com>
To: pgsql-sql@postgresql.org
Subject: select syntax question
Date: 01 Nov 2002 16:33:32 -0500
Message-ID: <1036186412.25294.2.camel@Monet> (raw)

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.





view thread (3+ messages)  latest in thread

Message-ID: <1036186412.25294.2.camel@Monet>
Permalink:  ../1036186412.25294.2.camel@Monet/
Also on:    postgresql.org/message-id/1036186412.25294.2.camel@Monet

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: wweng@kencast.com
  Subject: Re: select syntax question
  In-Reply-To: <1036186412.25294.2.camel@Monet>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox