tags:

views:

36

answers:

1

Hi,

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 count of count(posts) in the query itself, like this?

ID  count(posts)
101 2344
102 3245
103 232
104 23
   ------
    5844
+6  A: 
SELECT  id, COUNT(*)
FROM    mytable
GROUP BY
        id WITH ROLLUP
Quassnoi
+1 for come to know of ROLLUP
Salil
Thank you very much. This is exactly what I need. I never knew something like this existed. Thanks.
JPro