Re: Bug? Changing where distinct occurs produces error?

From: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
To: Michael Loftis <mloftis(at)wgops(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Bug? Changing where distinct occurs produces error?
Date: 2006-07-07 22:22:01
Message-ID: 20060707222201.70558.qmail@web31814.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> 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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message lanczos 2006-07-07 22:41:40 re: How to insert .xls files into database
Previous Message Stephan Szabo 2006-07-07 22:19:29 Re: Bug? Changing where distinct occurs produces error?