-3

現在、次のクエリがあります。

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
-----------------------------------------------------------
4

2 に答える 2

0

次のグループのみが欠落しています:

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'
Group By ui.email,ui.userid,ep.add_date
于 2013-03-22T07:09:29.360 に答える
0
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 = ui.userid 
where DATE(rc.add_date) = '2012-03-22' Group By ui.email,ui.userid,ep.add_date;
于 2013-03-22T07:11:11.427 に答える