如果你想,你收到排在當前查詢的所有Total_Volume的總和,你可以使用:
SELECT SUM(Total_Volume)
FROM (
select DATEPART(month,date) as month ,
sum(volume) as Total_Volume
from traffic_data_replica
where
DATENAME(weekday,date)='sunday'
and DATENAME(year,date)=2013
group by DATEPART(month,date)
order by DATEPART(month,date)
) AS Data
如果你想,你收到排在當前查詢的行數,你可以使用:
SELECT COUNT(*)
FROM (
select DATEPART(month,date) as month ,
sum(volume) as Total_Volume
from traffic_data_replica
where
DATENAME(weekday,date)='sunday'
and DATENAME(year,date)=2013
group by DATEPART(month,date)
order by DATEPART(month,date)
) AS Data
你是什麼意思的結果的總和多少?你需要查詢返回的記錄數還是Total_Volume的總和? –
什麼是查詢錯誤? – Amit
上面的查詢將返回結果行,我想它的總和 – bibinmatthew