SQL Server : trouble with ROW_NUMBER OVER PARTITION BY -
i having trouble in calculating maximum of row_number
in sql statement.
i query search originaldocumentnumber
data not same query http://i.stack.imgur.com/xwvn9.png
select originaldocumentnumber, filterround, p2_reason, rowno, p2_finalgrade (select * ,row_number() on (partition originaldocumentnumber,filterround order p2_finalgrade desc) rowno #tempda ) l l.p2_finalgrade in ('d','f') , l.rowno = 1 , l.originaldocumentnumber='590200054' , l.originaldocumentnumber+l.filterround not in (select originaldocumentnumber+filterround #tempda p2_finalgrade in ('a','b','c'))
query 2 output image query 2
select originaldocumentnumber ,filterround , p2_reason , rowno , p2_finalgrade ( select * ,row_number() on (partition originaldocumentnumber,filterround order p2_finalgrade desc) rowno #tempda ) l l.p2_finalgrade in ('d','f') , l.rowno = 1 -- , l.originaldocumentnumber='590200054' , l.originaldocumentnumber+l.filterround not in (select originaldocumentnumber+filterround #tempda p2_finalgrade in ('a','b','c'))
Comments
Post a Comment