Re: "for SELECT DISTINCT, ORDER BY expressions must appear in select list" - is that the standart or a limitation of postgresql?

From: Richard Huxton <dev(at)archonet(dot)com>
To: Walter Cruz <walter(dot)php(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: "for SELECT DISTINCT, ORDER BY expressions must appear in select list" - is that the standart or a limitation of postgresql?
Date: 2007-02-15 13:35:18
Message-ID: 45D46196.2090003@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Walter Cruz wrote:
>
> SELECT distinct name from test order by number
>
> (well, I think that que query doesn't make any sense, but raises the
> error :) )
>
> The error: ERROR: for SELECT DISTINCT, ORDER BY expressions must
> appear in select list is due to a standart implementarion or a design
> decision of postgres?

I think ORDER BY is defined to take place after DISTINCT, which means
there is no meaningful "number" for it to order by. You could
arbitrarily choose the first number encountered, but I can't see what
sense it would make to order by them.

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Glaesemann 2007-02-15 14:04:04 Re: "for SELECT DISTINCT, ORDER BY expressions must appear in select list" - is that the standart or a limitation of postgresql?
Previous Message Walter Cruz 2007-02-15 11:19:28 "for SELECT DISTINCT, ORDER BY expressions must appear in select list" - is that the standart or a limitation of postgresql?