Skip to content
Advertisement

How to count “Sunday” of the month to count absent employees

I have a problem calculating employee absenteeism in a month. In my query it still counts the day of the ‘sunday’ in this month, which shouldn’t count.

This is an sample database used :

emp0003 table’s

NIK Name
01190301 Susan

dvc0004 table’s

NIK Enroll
01190301 2021-02-08 07:20:39
01190301 2021-02-06 14:37:08
01190301 2021-02-06 07:57:42
01190301 2021-02-05 17:29:00
01190301 2021-02-05 08:09:54
01190301 2021-02-04 19:21:38
01190301 2021-02-04 08:12:44
01190301 2021-02-03 17:44:02
01190301 2021-02-03 08:06:27
01190301 2021-02-02 18:52:15
01190301 2021-02-02 08:02:32
01190301 2021-02-01 20:07:13
01190301 2021-02-01 07:55:49
01190301 2021-01-30 16:20:56
01190301 2021-01-30 07:59:45

this is my query sql:

this is result for my query sql :

NIK Name TOTAL ABSENT OF THE MONTH
01190301 Susan 1

should be the result:

NIK Name TOTAL ABSENT OF THE MONTH
01190301 Susan 0

because so far it has only passed one ‘sunday’ this month

Advertisement

Answer

You can use below query.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement