By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE employees
(`num_employee` int, `name` varchar(6))
;
INSERT INTO employees
(`num_employee`, `name`)
VALUES
(001, 'George'),
(002, 'Mary')
;
CREATE TABLE records
(`num_employee` int, `date` datetime)
;
INSERT INTO records
(`num_employee`, `date`)
VALUES
(001, '2021-12-01 00:00:00'),
(002, '2021-12-01 00:00:00'),
(001, '2021-12-02 00:00:00'),
(002, '2021-12-01 00:00:00'),
(001, '2021-12-03 00:00:00'),
(002, '2021-12-06 00:00:00')
;
select v.num_employee, v.name, v.date as missing
from (select * from (select distinct `date` from records) u cross join employees) v left join records
on v.`date` = records.`date`
and v.num_employee = records.num_employee
where records.`date` is null;
num_employee | name | missing |
---|---|---|
2 | Mary | 2021-12-02 00:00:00 |
2 | Mary | 2021-12-03 00:00:00 |
1 | George | 2021-12-06 00:00:00 |