用case when,比如我的如下: /** *SQL 根据不同状态,显示消脊汪不同列 **/ SELECT date(t.add_time) AS add_time, IFNULL(sum(CASE WHEN t.`status`=0 THEN trade_money END ),0) AS unsend_trade_money, IFNULL(sum(CASE WHEN t.`status`=1 THEN trade_money END ),0) AS send_trade_money, count(1) AS countPeople FROM lr_red_pocket_log t GROUP BY date(t.add_time);