日期:2014-05-18 浏览次数:20565 次
select cpdcode,iperiodindex,dbegindate,denddate ,case when iperiodindex = (select top 1 cValue from dbo.AccInformation where cname like 'iLastPeriod') then 1 else 0 end as 标记 from Period
------解决方案--------------------
上面效率太差
declare @cValue varchar(100) --根据实际修改类型 select top 1 @cValue = cValue from dbo.AccInformation where cname like 'iLastPeriod' select cpdcode,iperiodindex,dbegindate,denddate ,case when iperiodindex = @cValue then 1 else 0 end as 标记 from Period