SQLで商品毎に集計を行い、日別の売上分布を出力する
例 日別で集計結果のサマリー表示
SELECT ymd, SUM(CASE WHEN shohin_mei = '米' THEN sales ELSE 0 END) AS Rice_sales, SUM(CASE WHEN shohin_mei = 'パン' THEN sales ELSE 0 END) AS Bread_sales, SUM(CASE WHEN shohin_mei = 'サラダ' THEN sales ELSE 0 END) AS Vegetables_sales FROM sales_tbl GROUP BY ymd ;