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:[EMAIL PROTECTED] 
Sent: 31 January 2008 15:51
To: [email protected]
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.

Reply via email to