VÆLG DATE_FORMAT(PunchDateTime, '%W') DAY, MAX(CASE WHEN PunchEvent ='ClockIn' THEN DATE_FORMAT(PunchDateTime, '%r') END) ClockIn, MAX(CASE WHEN PunchEvent ='BreakOut' THEN DATE_FORMAT(PunchDateTime, '%r') END) BreakOut, MAX(CASE WHEN PunchEvent ='BreakIn' THEN DATE_FORMAT(PunchDateTime, '%r') END) BreakIn, MAX(CASE WHEN PunchEvent ='ClockOut' THEN DATE_FORMAT , '%r') END) ClockOutFROM tableNameWHERE EmpID =456GROUP BY DATE_FORMAT(PunchDateTime, '%W')ORDER BY PunchDateTime
OUTPUT
╔═══════════╦═════════════╦════════╦════════╦════════ ══════════╦═════════════╗║ Dag ║ ur ║ breakout ║ breakin ║ urout ║╠═══════════╬═ ════════════╬═════════════╬═════════════╬═════════ ════╣║ Tirsdag ║ 08:36:26 AM ║ 12:01:29 PM ║ 12:28:31 PM ║ 02:28:33 PM ║║ Onsdag ║ 3 07:38:8:39 AM ║ 07:38:41 AM ║ 07:38:42 AM ║╚═══════════╩════════════════════ ║