select count(distinct id) from svn where name='ant' and type='Bug'
和
select count(distinct id) from svn where name='ant' and type='Feature'
与单独运行相比,是否可以将它们组合成一个可能缩短执行时间的查询?
感谢您的回答。
答案 0 :(得分:4)
是的,你可以使用group by:
SELECT type, count(distinct id) AS cnt
FROM svn
WHERE name = 'ant'
AND type IN ('Feature', 'Bug')
GROUP BY type