newphpcoder
01-04-2012, 07:44 AM
i encountered problem in my select statement.
this is my query:
SELECT a.EMP_ID, CONCAT(LASTNAME, ', ' , FIRSTNAME) AS FULLNAME, a.LOG_IN, a.LOG_OUT
FROM hrdb.attendance AS a LEFT JOIN hris.employment em ON a.EMP_ID = em.EMP_NO
WHERE DATE(LOG_IN) BETWEEN '2011-12-08' AND '2011-12-23'
AND em.STATUS = 'Casual' OR LOG_IN IS NULL
the output of this query is all data from attendance table was displayed eventhough their STATUS is not Casual.
Thank you so much...
this is my query:
SELECT a.EMP_ID, CONCAT(LASTNAME, ', ' , FIRSTNAME) AS FULLNAME, a.LOG_IN, a.LOG_OUT
FROM hrdb.attendance AS a LEFT JOIN hris.employment em ON a.EMP_ID = em.EMP_NO
WHERE DATE(LOG_IN) BETWEEN '2011-12-08' AND '2011-12-23'
AND em.STATUS = 'Casual' OR LOG_IN IS NULL
the output of this query is all data from attendance table was displayed eventhough their STATUS is not Casual.
Thank you so much...