sql - Ascending and Decending ORDER BY clauses in a single query -
i working on these problems class i"m taking, 1 has me stumped. here problem:
--using author table, write query list information authors --whose first name ends “a”. put results in descending order of last name, --and ascending order first name. should done using single query.
here i've come far:
select * author where(fname '%a') order lname desc, fname asc;
however in result information ordered last name descending. first name ascending doesn't seem work.
any thoughts on i'm missing? using oracle express 10g, if matters. thanks.
there nothing wrong query. have pay attention data :-) here how interpret data output:
--------------+-------------- zzz | john zza | adam zaa | bob ccc | jack ccc | john cca | mike
so, ordering works instruct oracle - lname desc, fname acs, need realize fname asc
comes in picture once lname desc
processed. in other words: zzz
comes before zza
, once ccc
ordered , jack
comes before john
.
Comments
Post a Comment