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

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -