色婷婷狠狠18禁久久YY,CHINESE性内射高清国产,国产女人18毛片水真多1,国产AV在线观看

如何寫SQL語句按周統(tǒng)計和按季度統(tǒng)計

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

如何寫SQL語句按周統(tǒng)計和按季度統(tǒng)計?

--SQLserver2005語法統(tǒng)計按周,月,季,年。--按日--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)