时间:2021-07-01 10:21:17 帮助过:4人阅读
4.3.2 连续聚和
select OBJECT_ID(‘Sales.OrderTotalsByYear‘) if OBJECT_ID(‘Sales.OrderTotalsByYear‘) is not null drop view Sales.OrderTotalsByYear go create view Sales.OrderTotalsByYear with schemabinding as select YEAR(o.orderdate) as orderyear, SUM(od.qty) as qty from Sales.Orders as o join Sales.OrderDetails as od on o.orderid=od.orderid group by YEAR(o.orderdate) goView Code
学习Microsoft SQL Server 2008技术内幕:T-SQL语法基础--第4章
标签: