MySql sum query -


i need mysql query following: select items in table, group them type, order them count type , sum count.

this i've done far:

select type, count(*) cnt $tbl_name group type order count(*) desc; 

this gives me count each group. should add code also show total count (sum counts every group).

select * ( select type type,  count(*) cnt  $tbl_name  group type rollup) inner_table order cnt desc; 

note forst row rolled total sum.

rollup reference


Comments

Popular posts from this blog

delphi - ESC/P programming! -

Cursor error with postgresql, pgpool and php -

c++ - error: use of deleted function -