Again I need your help community, I have the following table in my database, with the records of a user's schedule (the rout are fictitious)
I have registered three schedules with the same date and different time for the same user, if I want to check your availability of attention for a day x works correctly, this I do with the following query.
select * from (
SELECT MIN(horario.hrs_ini) AS hrs_ini, MAX(horario.hrs_ter) AS hrs_ter, id_hr,
fecha_registro
FROM horario
INNER JOIN usuarios ON horario.rut_usu = usuarios.rut_usu
WHERE usuarios.rut_usu= '17.811.942-4'
AND horario.lunes='ATTE. ESTUDIANTES' AND fecha_registro = (SELECT MAX(fecha_registro) FROM horario) ORDER BY id_hr DESC LIMIT 14
) tmp order by tmp.id_hr asc
The result of this is the following
Now, if I register the schedule for another user, all ok. But if I execute the same sql query above for the user who registers first, that is to say the one that has the rut_usu = '17 .811.942-4 ', the data shows them to me in null, but if I use the rut of the new user example rut_usu = '11 .111.111-1 ', is displayed correctly (for that user). Why is this happening?