I just want to count how many student users are online, but not included the account type "Admin" and "Professor", and this is my syntax that has an error
SELECT COUNT(`status`)
FROM `tbl_registration`
WHERE `status` = 'Online'
NOT HAVING accounttype IN ('Admin','Professor')
CodePudding user response:
You do not need having (which mostly slows down performance)
SELECT COUNT(status) FROM tbl_registration WHERE status = 'Online' AND accounttype NOT IN ('Admin','Professor')