这个有两种方法.1是用in,2是用row_number(),可根据情况来用。两种都可以。 2.举例。 方法1: ?
1 Java代码
2 select a.* from table1 a where a.column1 in (select max(column1) from table1 g
方法2: ?
1 2 3 4 5 6 7 8 9 10 11 12 13
Java代码
with nyr as (
select NYR,QYZX_DM,FXSP_XH,SPBM_DLJ,WBSP_GG,JGLX,JZJG,MAX(SJGX_SJ), ROW_NUMBER() over (partition by nyr order by nyr) as 'rowno'
from WD_O_T_IC_SPSJ_FX where rowno=1
group by NYR,QYZX_DM,FXSP_XH,SPBM_DLJ,WBSP_GG,JGLX,JZJG
order by NYR,QYZX_DM,FXSP_XH,SPBM_DLJ,WBSP_GG,JGLX,MAX(SJGX_SJ) desc )
select * from nyr
where rowno = 1
因篇幅问题不能全部显示,请点此查看更多更全内容