Pada masa ini terdapat empat jadual berbeza dan jumlahkan data setiap hari secara berasingan
Sila beritahu saya cara menggabungkan dan membuat pertanyaan jumlah setiap hari dalam empat set data yang berbeza mengambil tahun, bulan dan hari
SELECT
DATE_FORMAT(createTime, '%Y-%m-%d') AS 日期,
count(*) AS 注册人次
FROM
tokenlog
WHERE createTime BETWEEN '2017-05-01' AND '2017-05-31'
GROUP BY
DATE_FORMAT(createTime, '%Y-%m-%d')
ORDER BY
createTime
===============================================
SELECT
DATE_FORMAT(logTime, '%Y-%m-%d') AS 日期,
count(*) AS 场次
FROM
sumelog
WHERE logTime BETWEEN '2017-05-01' AND '2017-05-31'
GROUP BY
DATE_FORMAT(logTime, '%Y-%m-%d')
ORDER BY
logTime
===============================================
SELECT
DATE_FORMAT(logTime, '%Y-%m-%d') AS 日期,
Sum(sumelog.consume) AS 消耗金币
FROM
sumelog
WHERE logTime BETWEEN '2017-05-01' AND '2017-05-31'
GROUP BY
DATE_FORMAT(logTime, '%Y-%m-%d')
ORDER BY
logTime
===============================================
SELECT
DATE_FORMAT(endTime, '%Y-%m-%d') AS 日期,
count(DISTINCT userId) AS 参加活动人次
FROM
game_u
WHERE endTime BETWEEN '2017-05-01' AND '2017-05-31'
GROUP BY
DATE_FORMAT(endTime, '%Y-%m-%d')
ORDER BY
endTime
Keputusan paparan akhir diperlukan seperti berikut 2017 -05-0 3 16 8 8 16 2017 -05-04 4 1 1 4 2017-05-05 20 10 10 〜20
mysql Ambil perhatian bahawa struktur dan jenis jadual tidak diubah