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;
Why does this compound query statement c.isdeleted = 1 c.status=6 not work? The queried data only has fuzzy results
伊谢尔伦2017-05-16 13:16:40
When "AND" or "OR" of the condition appear simultaneously in a where statement, you should enclose multiple ORs in parentheses and then perform "AND" with AND, or enclose multiple ANDs in parentheses and then perform "AND" with OR. Make “or”