PL/SQL select statement help - ordering by column not selected
Posted on 2011-05-12
I'm trying to select a distinct column from a table. I want to order the result but not select the column I want to order by. I can't find a way to do it.
So, if I do a standard select statement.
Select distinct col2 from table1
I'll get the result
i.e. by default it's ordering alphabetically.
How do I order the result by Col1 in table 1, but still only return the distinct values? I've tried a few different things like using sub selects and using rownum etc.... can't figure it out. Appreciate the help.....