Select count(*) from result query

前端 未结 3 1548
一个人的身影
一个人的身影 2021-02-03 17:51

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:

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-03 18:41

    This counts the rows of the inner query:

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

    However, in this case the effect of that is the same as this:

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

提交回复
热议问题