tsql - Switch SQL result columns to rows and include a summary row beneath -


i'd below columns populate in place of rows , include summary row beneath it:

table1 id     name    value   group 001    bob     100     002    don     200     003    fay     300     b 

below example of desired output:

group       no    sum     group     2     300 group b     1     300     total       3     600 

select coalesce('group '+ [group], 'total') [group], count([group]) no, sum(value) sum table1 group [group] rollup 

http://sqlfiddle.com/#!6/655f4/3


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -