I am not sure why is this happenning
When I write first query , it returns 0 records which is good.
SELECT id, dayType, employeeID FROM records WHERE companyID = 2 AND employeeID = 22 AND endTime IS NULL
Then I found out that there are endtime with 0 AND NULL in column values so I added or endTime = 0, then it returns records
SELECT id, dayType, employeeID FROM records WHERE companyID = 2 AND employeeID = 22 AND endTime IS NULL or endTime = 0
Can someone assist please
CodePudding user response:
You need to use parenthesis for the correct logic:
SELECT id, dayType, employeeID
FROM records
WHERE companyID = 2
AND employeeID = 22
AND (endTime IS NULL or endTime = 0);