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=",">
使用mybatis框架在写sql的时候碰到一个异常: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 类似于sql这样出现的异常 SELECT * FROM eval_question WHERE id not in() 后来就查询前先判
在 SQL 中,我们如果在操作数据库时使用 WHERE 子句判断一个列的值是否为 NULL,我们不能够使用 column_name=null 来进行判断,这是不正确的,我们应该使用 is null 来进行判断. 上图中我们的测试表 t1 里面有两条记录,其中有一条记录的值全为 NULL,我们要通过 DELETE 语句来删除这条记录,如果我们使用 delete from t1 where id1=null; 来操作的话是删除不了这条数据的. 我们应该通过 delete from t1 where