SELECT
vehicle_id,IF (mileage_type = 1, mileage, 0) AS nonExcutionMileage,IF (mileage_type = 0, mileage, 0) AS excutionMileage
FROM
gps_basis.having_opened_vehicle_mileage_detail
SELECT vehicle_id,date,
case mileage_type when 0 then mileage else 0 end excutionMileage,
case mileage_type when 1 then mileage else 0 end nonExcutionMileage
FROM gps_basis.having_opened_vehicle_mileage_detail
网友评论