我有这样的mysql查询:
SELECT branch,ifnull(cluster,'Total --->')AS cluster,COUNT(rs) AS point,
(SELECT SUM(rp) from full_mcd
where full_mcd.cluster=sefiia_registered_outlet_rs.cluster GROUP BY full_mcd.cluster)
AS RP FROM sefiia_registered_outlet_rs GROUP BY branch,cluster WITH ROLLUP
结果:
---------------------------------
|Branch |Cluster |Point |RP |
---------------------------------
|branch a |Cluster 1 |1000 |200|
---------------------------------
|branch a |Cluster 2 |2000 |50 |
---------------------------------
|branch a |Total --->|3000 |50 |
---------------------------------
|branch b |Cluster 4 |1000 |120|
---------------------------------
|branch b |Cluster 3 |1000 |100|
---------------------------------
|branch b |Total --->|2000 |100|
---------------------------------
结果很好,除了行总数--->对于RP列。我该怎么办?