考完以后,我是这样写的。 SELECT province,COUNT(1),SUM(CASE WHEN is_shipped=0 THEN 1 ELSE 0 END) AS notship, SUM(CASE WHEN is_shipped=0 THEN 1 ELSE 0 END)/COUNT(1) AS notshipRatio FROM sysOrders WHERE is_delete=0 GROUP BY province ORDER BY province;