mercredi 13 septembre 2017

solving the query permission to attend in absence system?

select
                 id_user id,nm_user,count(*) datang,
               (
                       select
                            sum((hour(timediff(datang,'08:00'))*60)+minute(timediff(datang,'08:00')))
                       from kehadiran
                       where
                            id_user=id and timediff(datang,'08:00') > '00:00' and
                            tgl_kehadiran >= '".$awal."' and
                            tgl_kehadiran <= '".$akhir."'
               ) as telat,
                 (
                       select
                            count(*) izin
                       from izin
                       where
                            id_user=id and
                            tgl_izin >= '".$awal."' and
                            tgl_izin <= '".$akhir."'
               ) as izin
            from kehadiran
            where
                  tgl_kehadiran >= '".$awal."' and
                  tgl_kehadiran <= '".$akhir."' and
                  substring(id_user,1,2) in ('12','13','14','15','16') and pulang is not null
            group by id_user
            order by datang desc, telat asc

this is my query, i have problem with this, can you help me? any body solving m problem? I want to make employee attendance become visible with the above query.database Thank you




Aucun commentaire:

Enregistrer un commentaire