加入收藏 | 设为首页 | 会员中心 | 我要投稿 湖南网 (https://www.hunanwang.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程 > 正文

java – 怎样对具有差异也许性的单个列的记录求和?

发布时间:2021-04-02 14:30:32 所属栏目:编程 来源:网络整理
导读:我有一个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+ 从这个查询我没有.全天礼品. 我有pres

我有一个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+

(编辑:湖南网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读