Comments (4)
  • Add a Comment
  • Edit
  • More Actions v
  • Quarantine this Entry

1 AndrejFurlanič commented Permalink

Recently i upgraded a database from 9.5 to 9.7 and certain queryies involving distinct and order by started to fail with sql0214 rc2.

 
I found this APAR open for 9.7: APAR IC75127 . Thanks to your blog, we found that "truth lies somewhere between", and corrected our queries.
 

2 SergeRielau commented Permalink

Andrej,

 
Always good to hear the blog helps someone :-)
 
Cheers
Serge

3 Tonkuma commented Permalink

GROUP BY and ORDER BY MAX(visit) will work, too.

 
------------------------------ Commands Entered ------------------------------
SELECT name , firstname
FROM guests
GROUP BY
name , firstname
ORDER BY
MAX(visit) ASC
;
------------------------------------------------------------------------------
 
NAME FIRSTNAME
-------------------- --------------------
Gervais Gerald
Dreyfus Don
Eakes Edwin
Fox Frauke
Beaver Boris
Chambers Charlene
Jones Jeremy
 
7 record(s) selected.

4 SergeRielau commented Permalink

Tonkuma,

 
SMART!
 
I never thought of adding an aggregate function to ORDER BY..
 
Cheers
Serge