MSSQL:
select * from table1
Where Case When Conditions1='' and field1=field2 Then 1 When Conditions1='1' and field2=field3 then 1 Else 0 END =1
MYSQL:
select * from table1
Where Case Conditions1 When '' Then field1=field2 When '1' Then field2=field3 Else 0=1 END
Conditions1为条件变量,这样可以实现根据不同的条件来查询出不同的数据,不用写多个SQL语句