sql server - T-SQL Query showing Random Results and is Not Ordering Results in DESC Order -


i having issues following t-sql query. first query shown below 1 working fine historically. there no date parameter in query , grouped top scores user , listed top scores in descending order.

the second query 1 not doing it's supposed to. basically, instead of ordering results in descending order highest lowest, it's showing top scores shows them in random order.

first query w/ no date parameters (this working should showing top scores in descending order):

with gscore (     select top 10 userid, max(gamescore) score        rg_gamescore     gameid = 15      group userid     order max(gamescore) desc ) select  gscore.score gamescore,         usr.userid,         usr.displayname    gscore inner join rg_users usr on gscore.userid = usr.userid    

second query date parameters (not working should, showing top scores not listing them in descending order, seems randomizing them every time run query):

with gscore (     select top 10 userid, max(gamescore) score        rg_gamescore     gameid = 15     , scoredate > '4/1/2013' , scoredate < '4/30/2013'     group userid     order max(gamescore) desc ) select  gscore.score gamescore,         usr.userid,         usr.displayname    gscore inner join rg_users usr on gscore.userid = usr.userid    

obviously scoredate affecting order of results don't know how fix it. help/advice on 1 appreciated.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -