gpt4 book ai didi

mysql - 如何使用计数一列并由每个 id 分隔

转载 作者:行者123 更新时间:2023-11-29 07:18:29 27 4
gpt4 key购买 nike

我想计算我的员工分开但合并在一起的出勤率

My target output

我的代码

 SELECT count(employees_id) as numbers FROM attendance WHERE in_time != ' ' AND out_time != ' 'AND employees_id = 1
SELECT count(employees_id) as numbers FROM attendance WHERE in_time != ' ' AND out_time != ' 'AND employees_id = 260

需要帮助将它们分开谢谢 :)

最佳答案

您可以尝试以下 - 使用 group by 和 employee_id

SELECT employees_id,count(*) as numbers 
FROM attendance WHERE in_time != ' ' AND out_time != ' '
group by employees_id

关于mysql - 如何使用计数一列并由每个 id 分隔,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57849152/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com