Hej, mam problem z takim oto zapytaniem.
Mam dwie tabele:
user_tab
user_id, name
absence_tab
absence_id, user_id, absence_from, absence_to
Generalnie mam zapytanie ktore wybira mi userow w konkretnym dniu ktorzy byli obecni (czyli nie bylo ich w tabeli absence_tab)
SELECT u.* FROM user_tab u WHERE NOT exists(select 1 from absence_tab a where a.user_id = u.user_id and :date between a.absence_from and a.absence_to)
Natomiast problem mam z zapytaniem ktory jako rezultat zwrocilby mi arraya z parami [dzien, liczba obecnych] gdzie jako argument przekazywany bylby przedzial dat od - do.
dzieki za wskazowki