select * from xxx
where (c1 is null or c1 like '%...%')
and (c2 is null or c2 like '%...%')
and...
难道不是这样吗……
SQLServer全文检索
现在想要查找出email为aaa开头的,address为bei开头的记录
那么一般我们会构建如下SQL select * from orders o where o.email like 'aaa%'and o.address like 'bei%'
其实我们可以使用如下SQL来缩短SQL语句(也就是连接字段一起进行like操作) SELECT * FROM orders o where concat(o.email,o.address) like 'like%df%'
|