I am trying to create a query that will search for fields in a database that only have one type of value. E.g. each person (regNum) can have up to four types of status at any one time (‘A‘, ‘B‘, ‘C‘ or ‘D‘) and I would like to find those that only have status of ‘C‘.
SELECT DISTINCT tbl_studentModules.regNum FROM tbl_studentModules
LEFT JOIN tbl_student
ON tbl_student.regNum = tbl_studentModules.regNum
WHERE status ? 'C' AND level = $level"
The question mark represents where I would like a statement that would say something similar to ‘is only’.
1 Answer