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