SELECT COUNT(*) AS num FROM lzh_cds c LEFT JOIN lzh_rds r ON c.rd_id=r.rd_id LEFT JOIN lzh_borrowers b ON c.borrowers_id=b.id
WHERE c.isdeleted = 1 AND c.cd_id LIKE '%李四%' OR c.cd_no LIKE '%李四%' OR b.name LIKE '%李四%' OR r.rd_no LIKE '%李四%' AND c.status=6;
为什么这条复合查询语句 c.isdeleted = 1 c.status=6 并没有起作用啊,查询出来的数据只有模糊结果
一个where语句中同时出现条件的“与”或者“或的时候”,要将多个OR用小括号括起来再和AND进行“与”,或者将多个AND用小括号括起来再与OR进行“或”