I have a table that has the results of tests.
It looks like:
Test | Result
Math | Pass
Science | Fail
History | cancelled
French | Absent
The table is named table1. I want to delete rows in the table where the value of the column result is not "Pass"
or "fail"
Something like:
Delete from table1
where result not in (Pass, Fail);
The resulting table would look like:
Test | Result
Math | Pass
Science | Fail
尝试这个:
DELETE FROM table1 WHERE result NOT IN ('Pass', 'Fail');
Your example worked for me by adding quotes around Pass
and Fail
.
delete from table1
where result not in ('Pass', 'Fail')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.