select A.user_id,ifnull(sum(ifnull(A.ex_cpu,0)),0) AS a0, ifnull(sum(ifnull(A.ex_mem,0)),0) AS a1, ifnull(sum(ifnull(A.ex_disk,0)),0) AS a2, ifnull(sum(ifnull(B.cpu,0)),0) AS a3, ifnull(sum(ifnull(B.mem,0)),0) AS a4, ifnull(sum(ifnull(B.disk,0)),0) A