1,给出正确的sql和截图
select * from (select glorgbookcode, glorgbookname, builtyear, row_number() over(partition by glorgbookname order by builtyear desc,glorgbookcode desc) mm from (select t.builtyear, b.glorgbookcode, b.glorgbookname from gl_initbuild t, bd_glorgbook b where t.pk_glorgbook = b.pk_glorgbook and t.dr = '0' and b.glorgbookname not like '%核算%')) where mm = 1 order by glorgbookcode, builtyear desc
一个order by builtyear desc也是可行的。
2,仅仅一个 order by glorgbookcode desc,不可行。
3,少一个desc也是不行(ps:order by 后面不写东西,默认是升序asc)
4,对builtyear的升序排序asc不可行。