これを試してください: SELECT client, job_type, sum(actual_value_fee) FROM jo2details GROUP BY client, job_type WITH ROLLUP