我有一个包含测试结果的表。
它看起来像:
Test | Result
Math | Pass
Science | Fail
History | cancelled
French | Absent
表命名为table1。我想删除表中列结果的值不是"Pass"
或"fail"
类似:
Delete from table1
where result not in (Pass, Fail);
结果表如下所示:
Test | Result
Math | Pass
Science | Fail
试试这个:
DELETE FROM table1 WHERE result NOT IN ('Pass', 'Fail');
您的示例通过在Pass
和Fail
周围添加引号为我工作。
delete from table1
where result not in ('Pass', 'Fail')