sqlserver中使用变量

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中变量的操作。

posted @ 2013-01-18 18:40  瓜王  阅读(279)  评论(0编辑  收藏  举报