Re: Select records from next date
Posted by:
Rick James
Date: April 30, 2015 07:35PM
You probably need PRIMARY KEY(attendance_id) in that table.
What if someone starts/ends outside both of those "shifts"? Which shift of which day should it count toward?
You have not examples of someone taking a break mid-shift, so the test case may fail to properly account for such.
SELECT fk_employee_id, start_date,
MIN(in_time), MAX(out_time)
FROM (
SELECT fk_employee_id,
DATE(COALESCE(in_time, out_time) -
INTERVAL 8 HOUR) AS start_date,
in_time,
out_time
FROM sc_attendance
) x
GROUP BY fk_employee_id, start_date;
Subject
Written By
Posted
Re: Select records from next date
April 30, 2015 07:35PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.