SELECT sum(t1.paymoney) as value,t1.ChargeWay as name,
FROM swyx_PayCharge t1
inner join swyx_charge t2 ON t2.id=t1.ChargeId
inner join swyx_accountcover t3 ON t2.accountcoverid=t3.id
inner join Swyx_accountcover t4 ON t4.id=t1.accountcoverid
where t1.gc_flag='0'
group by t1.chargeway
__这是SQL
我想把0和3的统计在一起,这改这么办亚、呀
我想把0和3的统计在一起,这改这么办亚、呀
参考 Sql分组的问题,Group是如何分组的 ,试试下面的笨方法:
SELECT sum(t1.paymoney) as value,
(CASE t1.chargeway WHEN 0 THEN 3
WHEN 3 THEN 3
ELSE 6 END ) as name,
FROM swyx_PayCharge t1
inner join swyx_charge t2 ON t2.id=t1.ChargeId
inner join swyx_accountcover t3 ON t2.accountcoverid=t3.id
inner join Swyx_accountcover t4 ON t4.id=t1.accountcoverid
where t1.gc_flag='0'
GROUP BY
CASE t1.chargeway
WHEN 0 THEN 3
WHEN 3 THEN 3
ELSE 6 END;
这样不行呀