表模式幫助建立這樣的:需要一個MySQL查詢分組
userID Points timestamp
1 40
3 20
1 10
4 15
3 5
需要能夠提交一份報告,顯示如下:
Total Points Allocated for the Day (0 if none allocated), (nice to have) To what userID's the points were allocated to for that day
我嘗試以下以及你可以看到不正確
SELECT uid, DATE(time_stamp) AS date, SUM(points) AS total_points
FROM table
GROUP BY date
時間戳未正確輸入。我的意思是我看到很多NULLS,並且日期是錯誤的。今天應該是什麼東西,我看到2012. – jini 2010-08-18 18:04:08
你用什麼來填充你的桌子? – XstreamINsanity 2010-08-18 18:06:41
時間戳只是一個unix時間戳。所以我有像1256235850,1256255246這樣的值,當你做日期(時間戳) – jini 2010-08-18 18:12:15