I have this first query that only shows names with the registration date of the current day:
SELECT nome,
centrodb.registoMiDe.Quarto,
DataRegisto,
Miccao,
Tipo1,
Dejeccao,
Tipo
FROM centrodb.utentes LEFT OUTER JOIN centrodb.registoMiDe
ON centrodb.registoMiDe.NomeUtente = centrodb.utentes.nome
WHERE descricaovalencia = 'LAR' AND nome <> 'CLASSE' AND DAY(DataRegisto) = DAY(CURDATE())
Now in the next query I show all the names with the registration date null and days behind the current date:
SELECT nome,
centrodb.registoMiDe.Quarto,
DataRegisto,
Miccao,
Tipo1,
Dejeccao,
Tipo
FROM centrodb.utentes LEFT OUTER JOIN centrodb.registoMiDe
ON centrodb.registoMiDe.NomeUtente = centrodb.utentes.nome
WHERE descricaovalencia = 'LAR' AND nome <> 'CLASSE' AND DataRegisto IS NULL OR DAY(DataRegisto) < DAY(CURDATE())
Now the goal is just to show names that have not yet been registered with the current day's record date.