select ifnull(b.chargeNum,0) as chargeNum,ifnull(a.electricNum,0) as electricNum,ifnull(c.electricity,0) as electricity,ifnull(d.mileage,0) as mileage from (
select count(1) as electricNum from test_car_statistical where type=1 and date(create_time) = curdate()
) a
LEFT JOIN
(
select count(1) as chargeNum from test_car_statistical where type=2 and date(create_time) = curdate()
) b
on 1=1
LEFT JOIN
(
select sum(electricity) as electricity from test_car_statistical where date(create_time) = curdate()
) c
on 1=1
LEFT JOIN
(
select sum(mileage) as mileage from test_car_statistical where date(create_time) = curdate()
) d
on 1=1
效果