譬如
select count(*) from A where type = 'dog'
select count(*) from A where type = 'cat'
这两个怎么合并呢?
这里我只是举个例子
每个类型的结果我都是需要的,另外条件查询会更复杂的,可能还是 addtime > And addtime < **
PHPz2017-04-10 17:46:17
直接用 UNION ALL
合并查询内容可否
SELECT count(*), 'dog' as type FROM A WHERE type='dog'
UNION ALL
SELECT count(*), 'cat' as type FROM A WHERE type='cat' AND addtime > '2016-0-11-14'