日期:2014-05-17  浏览次数:20531 次

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')
------解决方案--------------------

不知道你要的是不是上图的结果