sql - mysql sum only specific groups of a table -


is there way sum specific groups of table? example if have

keys  /  vals     /   1     /   2 b     /   3 b     /   3  c     /   1 c     /   1 

and want grouping , c not others such b above:

keys  /  vals     /   3 b     /   3 b     /   3  c     /   2 

this seems straightforward stored proc not sure if possible query?

union all non-b part b part:

select keys, sum(vals) tablename keys <> 'b' group keys union select keys, vals tablename keys = 'b' 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -