【发布时间】:2016-03-23 07:48:30
【问题描述】:
我有一个 mysql 查询(由 sagi 创建):-
SELECT 'blr' AS Location, COUNT(*) AS playCnt, (select count(*) from blr_skip WHERE blr_skip_dt like '%2016-03-20%') as skipCnt FROM blr_play WHERE blr_play_dt like '%2016-03-20%' UNION SELECT 'chen' AS Location, COUNT(*) AS playCnt, (select count(*) from chen_skip WHERE chen_skip_dt like '%2016-03-20%') as skipCnt FROM chen_play WHERE chen_play_dt like '%2016-03-20%';
它给出这样的输出:-
+----------+---------+---------+
| Location | playCnt | skipCnt |
+----------+---------+---------+
| blr | 25 | 8 |
| chen | 12 | 1 |
+----------+---------+---------+
我想在列的末尾再添加一行总计:-
+----------+---------+---------+
| Location | playCnt | skipCnt |
+----------+---------+---------+
| blr | 25 | 8 |
| chen | 12 | 1 |
+----------+---------+---------+
|Total | 37 | 9 |
+----------+---------+---------+
【问题讨论】: