mysql条件空或不空检索

需求是:如果传的字段不为空则where中加条件,如果为空则此字段不为条件

方法:1.if判断动态增删sql(复杂)

2.方法是where (e.se_name='c' or 'c'='')  c为传来的字段数据,如果c存在,则or后面条件不成立,前面的成立,如果不存在则反之

引用:https://blog.csdn.net/qq_39651858/article/details/81738199

posted @ 2020-07-06 17:45  xiaochuchun  阅读(1814)  评论(0编辑  收藏  举报