0
select col1,sum(col2) from tablea src
join
(select distinct col3,ROW_NUMBER() OVER(ORDER BY col3 desc) as RN)
From tableb) trgt
where RN=1 and src.col3 = trgt.col3 group by col1
问题2:
select col1,sum(col2) from tablea src
join
(select distinct col3,ROW_NUMBER() OVER(ORDER BY col3 desc) as RN)
From tableb) trgt
where RN=2 and src.col3 = trgt.col3 group by col1
加入查询:
select *
from (Query 1) curr join (Query 2)
prev on curr.col1 = prev.col1
FAILED:ParseException的线6:75不能识别邻近输入 '为' 中 'CURR'子查询源
谢谢它的作品! –
如果你喜欢我的回答,请重音,谢谢。 – krokodilko