Click here to Skip to main content
15,915,336 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all this is my sql query

SQL
'select COUNT(flag)as rows from mytable where mycolomn0= 'N'  group by mycolomn1'
it will return
set of rows, i want to get the count of the above query return,how to do this..
Posted
Updated 11-Jul-12 22:54pm
v2

If you want the number of rows returned by the first query:
SQL
select count(*) from (select COUNT(flag)as rows from mytable where mycolomn0= 'N'  group by mycolomn1) as t


If you want the total number of rows returned :
SQL
select sum(rows) from (select COUNT(flag)as rows from mytable where mycolomn0= 'N'  group by mycolomn1) as t
 
Share this answer
 
Try this, you will get total count

SQL
select COUNT(flag)as rows from mytable where mycolomn0= 'N'


Why you need this

SQL
'group by mycolomn1



Thanks
Ashish
 
Share this answer
 
What about:
SQL
SELECT 
  COUNT(*)
FROM
  (select COUNT(flag) from mytable where mycolomn0= 'N'  group by mycolomn1)
 
Share this answer
 
? i guess you just need to remove the group by statement to count the returned rows.

SQL
select COUNT(flag)as rows from mytable where mycolomn0= 'N'
 
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