Search Postgresql Archives

Re: Bug? Changing where distinct occurs produces error?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> SELECT DISTINCT(ua.user_id),pa.poll_id FROM user_answers ua, poll_answers 
> pa WHERE pa.poll_answer_id = ua.poll_answer_id AND ua.active='Y';
> 
> Everything is fine, however if you run
> 
> SELECT pa.poll_id,DISTINCT(ua.user_id) FROM user_answers ua, poll_answers 
> pa WHERE pa.poll_answer_id = ua.poll_answer_id AND ua.active='Y';
> 
> ERROR:  syntax error at or near "DISTINCT" at character 19
> LINE 1: SELECT pa.poll_id,DISTINCT(ua.user_id) FROM user_answers ua,...
>                           ^

Notice: http://www.postgresql.org/docs/8.1/interactive/sql-select.html

According to the syntax for a select a distinct | distinct on must be the first column specified
in the syntax.

So perhaps it is designed that way.

Regards,

Richard Broersma Jr.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux