首页 > 代码库 > SQL SERVER 查询语句

SQL SERVER 查询语句

一、查询某一年的每月汇总数据

SELECT CONVERT(CHAR(7), FinishDate,120) as FinishDate, SUM(Amount) as Amount,convert(varchar,100*SUM(Amount)/65000000)+‘%‘ as Ratio FROM Consignment where year(FinishDate)=2015 GROUP BY CONVERT(CHAR(7), FinishDate,120) order by FinishDate

SQL SERVER 查询语句