Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (2.6k points)

I need help from you, this is my SQL query:

select count(SID) 
from Test 
where Date = '2012-12-10' 
group by SID

this is my result:

|2|
|3|
|4|
|3|

and now I have to count the results from the first query!

Expected result: 4 

1 Answer

0 votes
by (7.2k points)

To select count(*) from result query in MySql. you can easily understand, look at this example

select count(*)

from

(

  select count(SID) tot  -- add alias

  from Test 

  where Date = '2010-10-10' 

  group by SID

) src;  -- add alias

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Dec 22, 2020 in SQL by Appu (6.1k points)
0 votes
1 answer
asked Dec 26, 2020 in SQL by Appu (6.1k points)

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...