当前位置: 代码迷 >> Sql Server >> sql求和解决思路
  详细解决方案

sql求和解决思路

热度:85   发布时间:2016-04-24 22:54:02.0
sql求和
有一张表type字段记录着类型,amount记录着数量,如何用一句sql查询出type类型为a,b,c三者的amount记录数总和
SQL

------解决方案--------------------
select sum(amount),[type] from tb group by [type]

------解决方案--------------------
select sum(amount) amount from table1 where [type] in('a','b','c')
------解决方案--------------------

不知道你要的是不是上图的结果
  相关解决方案