coalesce(expr1,expr2,expr3...) 直到找到一个非null值返回,右边的表达式则不参与运算:若所有为null,返回null. eg:判断json是否包含某属性,若无,则取默认值. testdb=# select val * 2 from (select id, coalesce(cast(data->>'age' as decimal) , id ) val from testjson2)t; testdb=# select val * 2 from (select…
mysql text字段判断是否为空 mysql text字段为空select * from `tableName` where `textField` is null or `textField` = ''; mysql text字段不为空select * from `tableName` where `textField` is not null AND `textField` != '';…
mybatis判断集合为空或者元素个数为零: <if test="mlhs != null and mlhs.size() != 0"> and t.mlh_name not in <foreach collection="mlhs" item="item1" open="(" close=")" index="i" separator=",">…