can I combine these 2 simple queries into one query?
se开发者_JAVA百科lect count(distinct id) from svn where name='ant' and type='Bug'
and
select count(distinct id) from svn where name='ant' and type='Feature'
Is it possible to combine them into a single query that might reduce the execution time compared to running them individually?
Thanks for answering.
Yes, you can use group by:
SELECT type, count(distinct id) AS cnt
FROM svn
WHERE name = 'ant'
AND type IN ('Feature', 'Bug')
GROUP BY type
精彩评论