以下是我表中的数据
| count(*) | system |
| 2 | sys1 |
| 7 | sys2 |
| 6 | sys1 |
我想要输出如下
| count(*) | system |
| 8 | sys1 |
| 7 | sys2 |
我怎么做?
以下是我正在使用的查询。谁能告诉我这有什么问题?
select * from
(select count(*),system from tbl1 where creationDate < CURDATE() AND creationDate >= CURDATE() - INTERVAL 1 DAY group by system
UNION ALL
select count(*),system from tbl2 where creationDate < CURDATE() AND creationDate >= CURDATE() - INTERVAL 1 DAY group by system) as tbl3 group by system;