Hello Everyone, I wants to find the max. date and Login status of employee for Attendance table. The qurey runs fine but it shows me the wrong status.
select max(a.dAtt_Date),a.nLog_Status from tbl_attendance a,tbl_attendance b where a.nEmp_id = 1 and a.nLog_Status = b.nLog_Status group by b.nEmp_id for example :- the data is dAtt_Date nLog_Status --------- ----------- 2001-11-20 2 2001-11-22 1 2001-11-23 1 2001-11-24 1 2001-11-24 2 Result is max(a.dAtt_Date) nLog_Status ---------------- ------------- 2001-11-24 2 2001-11-20 2 Thanks Manish Mehta E-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php