现在我有以下查询:
SELECT
ui.email,
ui.userid,
SUM(ep.earnPoints),
ep.add_date
from earn_points as ep
INNER JOIN user_info as ui on ep.userid on ui.userid
where DATE(rc.add_date) = '2012-03-22';
我想通过各自的电子邮件获取个人使用的总收入点数
所以我的最终输出应该如下所示:
-----------------------------------------------------------
userid email earnPoints date
1 testuser@gmail.com 45 2012-03-22
2 testuser123@gmail.com 10 2012-03-22
3 testuser145@gmail.com 18 2012-03-22
-----------------------------------------------------------