row_number() OVER()
select * from tab
select b,c,sum(d) e from tab group by b,c -- 先根据b分 再根据c分
SELECT b, c, d,
SUM(d) OVER(PARTITION BY b,c ORDER BY d) e FROM tab
SELECT b, c, d,
SUM(d) OVER(PARTITION BY b,c ) e FROM tab
--为什么将 ORDER BY 拿掉就是这个样子?
select row_number() OVER(order by getdate())
--row_number() 必须跟 OVER() 还有 order by一起连用
select *, row_number() OVER(order by D) from tab