开发者

summing the sum in mysql

开发者 https://www.devze.com 2023-01-01 11:01 出处:网络
Say If I get a resultset in mysql as : IDcount(posts) 101 2344 102 3245 103 232 104 23 Is there any way to get the tota coun开发者_StackOverflowt of count(posts) in the query itself,

Say If I get a resultset in mysql as :

ID  count(posts)
101 2344
102 3245
103 232
104 23

Is there any way to get the tota coun开发者_StackOverflowt of count(posts) in the query itself, like this?

ID  count(posts)
101 2344
102 3245
103 232
104 23
   ------
    5844


SELECT  id, COUNT(*)
FROM    mytable
GROUP BY
        id WITH ROLLUP
0

精彩评论

暂无评论...
验证码 换一张
取 消