declare @Jan int,@Feb int select @Jan=count(*) from T_CALL_DOCTORCALL where callstate in(1,2) and updatetime>'2012-01-01' and updatetime<'2012-02-01' select @Feb=count(*) from T_CALL_DOCTORCALL where callstate in(1,2) and updatetime>'2012-02-01' and updatetime<'2012-03-01' select @Jan as '1月',@Feb as '2月'
脚本简单,正好复习一下sql中变量的操作。