我正在使用以下SQLite查询来获取Farmer或Buyer类型的数据。但是它也在该查询中显示已删除的数据。在表中,我的类型为Farmer,Worker和Buyer in i我想把未删除的数据与Farmer和Buyer一起删除。任何人都可以告诉我该查询有什么问题。
SELECT * FROM contacts WHERE user_id = 317 AND (is_deleted IS NULL or is_deleted != 'true') AND type = 'Farmer' OR type = 'Buyer' ORDER BY name COLLATE NOCASE ASC
表格结构:
答案 0 :(得分:0)
试试此代码
SELECT * FROM contacts WHERE user_id = 317 AND type != 'Worker' AND (is_deleted IS NULL or is_deleted != 'true') ORDER BY name COLLATE NOCASE ASC
而不是使用或者您可以使用上述查询。