Re: Tricky Order By in SQL?

From: TillKahle <tillkahle_at_aol.com>
Date: 1995/11/28
Message-ID: <49ftd8$oc7_at_newsbf02.news.aol.com>#1/1


Hi Kathy!

The problem is that in your case for putting LTS in the right place you need to decide which key value (H5 or I5) to use for the order by.

Two ways:

SELECT grade_req, min(grade_cd) FROM ref_grade GROUP BY grade_req ORDER BY 2

or

SELECT grade_req, max(grade_cd) FROM ref_grade GROUP BY grade_req ORDER BY 2

Probably you can even do ORDER BY min(grade_cd) without actually selecting it.

Cheers

Till Kahle, Hamburg Received on Tue Nov 28 1995 - 00:00:00 CET

Original text of this message