sql - Alphabetic ranking a list with set of 'WITH TIES - ORDER BY (multiple fields) -
a regular usage of "with ties" & result of query :
demand: best of 10 movies oscar wins
select top 10 ties f.filmname title, f.filmoscarwins [oscar wins] dbo.tblfilm f filmoscarwins not null order [oscar wins] desc;
when add "title" @ field of order make list alphabetical order, doesn't work properly!
no 13 movies in list
no alphabetic order
demand: best of 10 movies in alphabetical order:
select top 10 ties f.filmname title, f.filmoscarwins [oscar wins] dbo.tblfilm f filmoscarwins not null order [oscar wins] desc, title;
so should make alphabetical order while ranking set of 'with ties - order by'?
your query gets top 10 ranked oscar winning movies. top 10
, order by
in query.
now want use data set , show in order. means additional query own order by
clause:
select * ( select top 10 ties f.filmname title, f.filmoscarwins [oscar wins] dbo.tblfilm f filmoscarwins not null order [oscar wins] desc ) top10 order title;
Comments
Post a Comment