java - 如何解决where name like '%%' 当name 为null时,查询不到数据?
PHP中文网
PHP中文网 2017-04-18 10:44:56
0
12
1826
PHP中文网
PHP中文网

认证0级讲师

reply all(12)
大家讲道理

Why can’t we judge the two query variables before executing the SQL statement?

The pseudo code is as follows:

if (isNull(a)) {
    a = '';
}

if (isNull(b)) {
    b = '';
}
阿神

From the perspective of efficiency, it is strongly recommended that when name or method is empty, the value will not be used as a query condition
For example, if name is empty, it is directly
where method like '%xxx%'

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template