-
-
Save parzibyte/99bb0484c84e6cc9fcb66010663359f0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MariaDB [attendance]> select employee_id, | |
-> sum(case when status = 'presence' then 1 else 0 end) as presence_count, | |
-> sum(case when status = 'absence' then 1 else 0 end) as absence_count | |
-> from employee_attendance | |
-> group by employee_id; | |
+-------------+----------------+---------------+ | |
| employee_id | presence_count | absence_count | | |
+-------------+----------------+---------------+ | |
| 2 | 4 | 3 | | |
| 3 | 6 | 1 | | |
+-------------+----------------+---------------+ | |
2 rows in set (0.000 sec) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment