取d列的max的那条记录,重复的都要保留
a b c d
01 05 2013/04/25 1
01 05 2013/11/28 1
01 05 2013/08/26 2
01 93 2012/12/20 1
01 93 2011/08/17 1
01 93 2010/08/17 1
01 93 2011/05/18 1
最终要抽出
a b c d
01 05 2013/08/26 2
01 93 2012/12/20 1
01 93 2011/08/17 1
01 93 2010/08/17 1
01 93 2011/05/18 1
------解决思路----------------------
SELECT a,b,c,d FROM(
SELECT *
,DENSE_RANK()OVER(PARTITION BY a,b ORDER BY d DESC)RN
FROM TB
)T
WHERE RN=1