算2個數的差

select a.m1, b.m2, b.m2-a.m1 from
(select t_type, sum(t_money) as m1 from family.statement where t_type=1 group by t_type) a
join
(select t_type, sum(t_money) as m2 from family.statement where t_type=2 group by t_type) b;
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章