Skip to content

Instantly share code, notes, and snippets.

@parzibyte

parzibyte/salida.txt Secret

Created Nov 22, 2020
Embed
What would you like to do?
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
You can’t perform that action at this time.