select * from table t1
的结果集与加上
where t1.code = t1.code
之后的结果集
可能不一样
当code为null的一些记录在加上where语句就不会显示!!!!
故语句
select * from table t1 where t1.code =
(case @dynamic_branchid when -1 then t1.code else @dynamic_branchid end )
应分开来写
if(@dynamic_branchid =-1)
select * from table t1
else
select * from table t1 where t1.code =@dynamic_branchid
的结果集与加上
where t1.code = t1.code
之后的结果集
可能不一样
当code为null的一些记录在加上where语句就不会显示!!!!
故语句

(case @dynamic_branchid when -1 then t1.code else @dynamic_branchid end )
应分开来写



