This is the table structure
CREATE TABLE `student_classlists` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`SessionCode` int(5) DEFAULT NULL,
`CourseCode` varchar(10) DEFAULT NULL,
`SectionCode` varchar(1) DEFAULT NULL,
`LastName` varchar(255) DEFAULT NULL,
`FirstName` varchar(255) DEFAULT NULL,
`StudentId` int(10) unsigned DEFAULT NULL,
`FinalGradeSIS` int(10) DEFAULT NULL,
`Status` varchar(10) DEFAULT NULL,
`Faculty` varchar(255) DEFAULT '',
`Email` varchar(255) DEFAULT NULL,
`ClassListDate` date DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=576 DEFAULT CHARSET=utf8;
The Status
column is largely composed of NULL
rows, with just a few exceptions. I am trying to ignore those records that are not null. The following query does not work:
SELECT StudentId FROM student_classlists WHERE `Status` NOT IN ('Drop') GROUP BY StudentId
For some reason it produces an unexpected and empty result. But a very similar query with the only exception of dropping the NOT
produces an expected result
SELECT StudentId FROM student_classlists WHERE `Status` IN ('Drop') GROUP BY StudentId
What's happening here?