Curdate mysql не работает функция
Нужен отчет на сегодня
Когда ставится код без этой строки
#where p.VrijemePrijave = CURDATE()
Работает нормально
Когда ставится эта строка (отчет на сегодня) результат оказывается пустым
Что я уже пробовал:
SELECT o.Ime, sum(case when (TIME(p.VrijemePrijave) between '13:00' and '22:00') and (TIME(p.VrijemeOdjave) between '00:00' and '04:00') then (SELECT FLOOR((TIME_TO_SEC(TIMEDIFF('22:00', DATE_FORMAT(p.VrijemePrijave,'%H:%i:%s')))) / 3600)) else case when (TIME(p.VrijemePrijave) between '17:00' and '22:00') and (TIME(p.VrijemeOdjave) between '00:00' and '15:00') then 0 else (case when WEEKDAY(VrijemePrijave) in (5, 6) then 0 else (CASE WHEN(SELECT FLOOR((TIME_TO_SEC(TIMEDIFF(p.VrijemeOdjave, p.VrijemePrijave))) / 3600)) > 8 THEN 8 else (SELECT FLOOR((TIME_TO_SEC(TIMEDIFF(p.VrijemeOdjave, p.VrijemePrijave))) / 3600)) END) end) end end ) AS 'SATI [h]', sum(case when (TIME(p.VrijemePrijave) between '13:00' and '22:00') and (TIME(p.VrijemeOdjave) between '00:00' and '04:00') then (SELECT FLOOR((TIME_TO_SEC(TIMEDIFF(DATE_FORMAT(p.VrijemeOdjave,'%H:%i:%s'), '06:00'))) / 3600)) else case when (TIME(p.VrijemePrijave) between '17:00' and '22:00') and (TIME(p.VrijemeOdjave) between '00:00' and '15:00') then (SELECT FLOOR((TIME_TO_SEC(TIMEDIFF(DATE_FORMAT(p.VrijemeOdjave,'%H:%i:%s'), '06:00'))) / 3600)) + (SELECT FLOOR((TIME_TO_SEC(TIMEDIFF('22:00', DATE_FORMAT(p.VrijemePrijave,'%H:%i:%s')))) / 3600)) else (case when WEEKDAY(VrijemePrijave) in (5, 6) then(SELECT FLOOR((TIME_TO_SEC(TIMEDIFF(p.VrijemeOdjave, p.VrijemePrijave))) / 3600)) else (CASE WHEN(SELECT FLOOR((TIME_TO_SEC(TIMEDIFF(p.VrijemeOdjave, p.VrijemePrijave))) / 3600)) > 8 THEN((SELECT FLOOR((TIME_TO_SEC(TIMEDIFF(p.VrijemeOdjave, p.VrijemePrijave))) / 3600)) - 8) else NULL END) end) end end) AS 'PREKOVREMENO [h]', sum(case when (TIME(p.VrijemePrijave) between '13:00' and '22:00') and (TIME(p.VrijemeOdjave) between '00:00' and '12:00') then (SELECT CASE WHEN TIME(p.VrijemeOdjave) between '06:00' and '06:59' THEN 8 ELSE (SELECT FLOOR((TIME_TO_SEC(TIMEDIFF(DATE_FORMAT(p.VrijemeOdjave,'%H:%i:%s'), '00:00'))) / 3600))+2 END) else case when (TIME(p.VrijemePrijave) between '17:00' and '22:00') and (TIME(p.VrijemeOdjave) between '00:00' and '15:00') then (SELECT CASE WHEN TIME(p.VrijemeOdjave) between '06:00' and '06:59' THEN (SELECT FLOOR((TIME_TO_SEC(TIMEDIFF(DATE_FORMAT(p.VrijemeOdjave,'%H:%i:%s'), '00:00'))) / 3600))+2 ELSE 8 END) else null end end) as 'NOCNI RAD' from prijava_radnika p inner join osoba o on o.IdOsoba = p.IdPosjetioc #where p.VrijemePrijave = CURDATE() group by o.Ime order by o.Ime;