欧美一区二区三区,国内熟女精品熟女A片视频小说,日本av网,小鲜肉男男GAY做受XXX网站

如何寫SQL語句按周統計和按季度統計

李中冰2年前14瀏覽0評論

如何寫SQL語句按周統計和按季度統計?

--SQLserver2005語法統計按周,月,季,年。--按日--select sum(price),day([date]) from table_name where year([date]) ='2006' group by day([date])--按周quarterselect sum(price),datename(week,price_time) from ble_name whereyear(price_time) = '2008' group by datename(week,price_time)--按月select sum(price),month(price_time) from ble_name where year(price_time)= '2008' group by month(price_time)--按季select sum(price),datename(quarter,price_time) from ble_name whereyear(price_time) = '2008' group by datename(quarter,price_time)--按年select sum(price),year(price_time) from ble_name whereyear(price_time) >= '2008' group by year(price_time)