select a,sum(b) as totalQty
from tblName where idz=10
group by idz,a
注意idz如果不是数字则筛选10要对其加单引号
字符内容是无法参与计算的,要用cast函数将字符类型转换成数值类型如下:
select * from orderInfolist where cast(id as signed int) BETWEEN 120 and 150
欢迎分享,转载请注明来源:内存溢出
select a,sum(b) as totalQty
from tblName where idz=10
group by idz,a
注意idz如果不是数字则筛选10要对其加单引号
字符内容是无法参与计算的,要用cast函数将字符类型转换成数值类型如下:
select * from orderInfolist where cast(id as signed int) BETWEEN 120 and 150
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)