use Northwind;
-----------------
Select*
from dbo.Orders
-----
Select Count(*) as '訂單總筆數'
from dbo.Orders
----
Select Count(ShippedDate) as '已出貨總筆數'
from dbo.Orders
Select YEAR(OrderDate) as '年度',Count(*) as '訂單總筆數'
from dbo.Orders
Group by YEAR(OrderDate)
------
Select YEAR(OrderDate) as '年度',Datepart(Quarter,OrderDate) as '季',Count(*) as '訂單總筆數'
from dbo.Orders
GROUP BY YEAR(OrderDate),Datepart(Quarter,OrderDate)
Order BY YEAR(OrderDate),Datepart(Quarter,OrderDate)
---return bigint(ver.2005)
Select Count_BIG(*) as '訂單總筆數'
from dbo.Orders
沒有留言:
張貼留言