日期:2014-05-17 浏览次数:20879 次
SELECT B.ID, B.KID
from (SELECT A.ID,
A.KID,
ROW_NUMBER() OVER(PARTITION BY A.ID ORDER BY A.BEGINDATE DESC) AS XH
FROM T_BANK_DKDATA A) B
WHERE B.XH = 1;
select b.id, a.kid
from t_bank_dkdata a,
(select a.id, max(a.begindate) xh from t_bank_dkdata a group by a.id) b
where b.id = a.id
and b.xh = a.begindate