目前四個不同的表單獨查詢求和每天的資料
請教如何合併查詢四組不同資料每一天的和首列按日期排序只取年月日
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
要求最終顯示結果如下
日期註冊人次場次消耗金幣參加活動人次
2017-05-01 8 2 2 2 21 2 4 1 1 4
2017-05-03 16 8 8 16
2017-05- 4
2017-05-05 20 10 10 10 10
mysql 注意是在不改表結構和類型的情況下