輸入條件不定的SQL查詢

多个条件查詢,可以只输入一个,也可以输入2个或多个.甚至不输入.不输入就列出全部.


select * from 表名
 where (名字=@name or @name is null) and (工资<@pay1 or @pay1 is null) and (工资>@pay2 or @pay2 is null)
原文地址:https://www.cnblogs.com/Bluer/p/455110.html