代码写法:

    SELECT
            date_format(examinee_pay_time, '%Y-%m-%d') as payDate,
            COUNT(examinee_id) As realityApplyCount, <!-- 日缴费次数 -->
            sum((CASE WHEN examinee_exam_score IS NULL THEN exam_fee ELSE 0 END )) as realityApplyFee, <!-- 日缴费金额 -->
            exam_id,
            exam_name,
            examinee_pay_status,
            examinee_exam_status
        FROM
            schoolexam
        INNER JOIN examinee e ON exam_id = exam_item_id    AND  exam_type = examinee_apply_type
                                    AND (examinee_exam_status != '4' OR ISNULL(examinee_exam_status))
                                    AND examinee_pay_status = "1"
        <where>  
            1 = 1           
        </where>
        GROUP BY 
            date_format(examinee_pay_time, '%Y-%m-%d')

结果如下:

Mysql 根据时间统计总数

 

相关文章:

  • 2022-12-23
  • 2022-03-09
  • 2022-12-23
  • 2021-12-28
  • 2021-08-12
  • 2022-12-23
  • 2021-10-08
  • 2021-09-02
猜你喜欢
  • 2022-01-23
  • 2021-12-22
  • 2022-12-23
  • 2021-06-04
  • 2021-11-14
  • 2021-11-13
  • 2022-12-23
相关资源
相似解决方案