I have a table containing all the clock in and out records of my employees,
I am having trouble showing a list af all the curent employees, where their last clock was, and weather or not they are currently clocked in. The SQL I thought would work is
SELECT
employee_id,
clock_time,
clock_status,
location
FROM
time_clock
GROUP BY
employee_id
ORDER BY
clock_time DESC
the problem is, that it does the order by after it groups, so it shows the clock status for the top record. I know one possible solution is to sort the table every time before preforming the query, however as this is a VERY large table that would take too long... any other suggestions?