SQL 多条件查询以后我们做多条件查询,一种是排列结合,另一种是动态拼接SQL如:我们要有两个条件,一个日期@addDate,一个是@name第一种写法是if (@addDate is not null) and (@name <> '')select * from table where addDate = @addDate and name = @n..
当我写下如下sql语句时,我得到了输入@c参数时想得到的结果集。select * from @tb t where t.id in (select id from tb where f = @c) 但如果有@a,@b,@c,而它们分别想从@tb中得到不同的结果集,例如 复制代码 代码如下: if @a is not null begin -..