Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a table , attributes c1,c2,c3

Field 3 as c3 contains status 'open' or 'close'

I need to get open count and total count in a single query.
I used a query ,it returns proper value. But both count is same then return only
one row.
Posted

Try this one (replace tab by your table's name):
select count(c3), (select count(c3) from tab) from tab group by c3
 
Share this answer
 
Comments
R. Giskard Reventlov 3-Jun-10 11:12am    
Much prefer yours: just deleted mine: far too complicated!
try it


Select count(c3),(select count(c3) From tab where c3='open') From tab A
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900