1

enrolment_idstudent表中的外键,我想获取尚未设置外键的学生。含义(但这在子句enrolment_id = NULL中不起作用)。WHERE

该怎么办?

4

2 回答 2

3

比较NULL值时,请改用IS NULL谓词:

...
WHERE enrolment_ID IS NULL;

= NULL不会工作。

于 2013-01-15T06:36:00.603 回答
0
SELECT * FROM student AS s WHERE s.enrolment_ID IS NULL;
于 2013-01-15T06:45:40.863 回答