日期:2014-05-16 浏览次数:20505 次
declare @class varchar(20)
if @class=-1
begin
select * from xxx
end else
begin
select * from xxx where class=@class
end
select * from xxx where (if @class='-1' then 1=1 else class=@class end)
select * from xxx
where @class=-1 or @class=class