SUM(CASE WHEN shift_code = 1 THEN present ELSE 0 END) AS P1,
SUM(CASE WHEN shift_code = 1 THEN miss ELSE 0 END) AS M1,
SUM(CASE WHEN shift_code = 1 THEN late ELSE 0 END) AS L1,
SUM(CASE WHEN shift_code = 2 THEN present ELSE 0 END) AS P2,
SUM(CASE WHEN shift_code = 2 THEN miss ELSE 0 END) AS M2,
SUM(CASE WHEN shift_code = 2 THEN late ELSE 0 END) AS L2