我有一个mysql查询:
SELECT count(*) as `present_days`
FROM tbl_intime_status
WHERE employee_status = 'Out' and
present_status = 'Full Day' and
date LIKE '%/"+month2+"/"+year1+"' and
employee_id="+ EmpId+
从这个查询我没有.全天礼物.
我有present_status =’半天’& present_status =我的数据库记录中的’全天’.
如何计算’全天”半天’?
最佳答案
如果您希望计数分开,则可以执行此操作
SELECT present_status,count(*) as `present_days`
FROM tbl_intime_status
WHERE employee_status = 'Out' and
present_status IN ('Full Day','Half Day')
date LIKE '%/"+month2+"/"+year1+"' and
employee_id="+ EmpId+
GROUP BY present_status
如果你想要两者的总数这样做
SELECT count(*) as `present_days`
FROM tbl_intime_status
WHERE employee_status = 'Out' and
present_status IN ('Full Day','Half Day')
date LIKE '%/"+month2+"/"+year1+"' and
employee_id="+ EmpId+