Mysql case when的使用, 按天分组,统计crowd表,每天的完成人数
SELECT c.aid activity_id, DATE_FORMAT(c.createdate, '%Y%m%d') statistics_date,
COUNT(c.id) total,
SUM(
CASE
WHEN (
(
IFNULL(c.points, 0) + IFNULL(c.money, 0) + IFNULL(c.cashcoupon, 0)
) / a.pri
原创
2018-01-26 16:45:53 ·
1133 阅读 ·
0 评论