views:

44

answers:

1

select 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.

+4  A: 

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
Mark Byers
Bang ON!! Gosh, I can't believe I didn't think of that. I guess sometimes you are just trying to think on a much higher level when the solution is actually very easy. Thanks a lot though.
Gaurav