db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Williamson, Nick" <nick_william...@mentor.com>
Subject RE: distinct and order by
Date Thu, 31 Jan 2008 16:05:18 GMT
You can do it as long as the same column appears in both phrases.

Allowed:
select distinct project_id from projectproject order by project_id;

Not allowed:
select distinct project_id from projectproject order by name;

(ERROR 42879: The ORDER BY clause may not contain column 'NAME', since
the query
specifies DISTINCT and that column does not appear in the query result.)

HTH
Nick


 

-----Original Message-----
From: tom_ [mailto:tom12167@web.de] 
Sent: 31 January 2008 15:51
To: derby-user@db.apache.org
Subject: distinct and order by


I am using "disctinct" because of some self-joins and also needed to add
an "order by" clause. An error is shown. Is it not possible to use
distinct and order by together?

--
View this message in context:
http://www.nabble.com/distinct-and-order-by-tp15206572p15206572.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Mime
View raw message