SQL-カテゴリ毎+全部の合計金額を取得したい場合
select ifnull(c.name, '総計') , sum(ab.purchase_price) from test.account_books ab inner join test.categories c on c.id = ab.category_id group by c.name with rollup;
select ifnull(c.name, '総計') , sum(ab.purchase_price) from test.account_books ab inner join test.categories c on c.id = ab.category_id group by c.name with rollup;