1.统计
select
customerID,
SUM(totalPrice) over() as AllTotalPrice,
SUM(totalPrice) over(partition by customerID) as cusTotalPrice,
totalPrice
from OP_Order
2.over函数和row_numbert()函数配合使用,可生成行号。可对某一列的值进行排序,对于相同值的数据行进行分组排序
select row_number() over(order by AID DESC) as rowid,* from bb