1.多表更新
UPDATE pz_cause_ph t1,
pz_repairlist_22 t2,
pz_vin_vehicle t3,
pz_vehicle_conf t4
SET t1.pf = t4.config_value
WHERE
t1.wxspdbh = t2.co_wxspdbh
AND t2.vin = t3.co_vin
AND t3.co_vehicle = t4.vehicle_number
AND config_name ='xxxx'
2.if判断
UPDATE pz_cause_ph
SET cl =
CASE
WHEN cl <= 20000 THEN '0-20000'
WHEN cl > 20000 AND cl <= 50000 THEN'20000-50000'
WHEN cl >50000 AND cl <=100000 THEN '50000-100000'
WHEN cl >100000 AND cl <=200000 THEN '100000-200000'
ELSE '50000以上'
END
WHERE
cl IS NOT NULL
3.
SELECT
CASE
WHEN co_xslc <= 20000 THEN '0-20000'
WHEN co_xslc >20000 AND co_xslc <=50000 THEN '20000-50000'
WHEN co_xslc > 50000 AND co_xslc <=100000 THEN '50000-100000'
WHEN co_xslc > 100000 AND co_xslc <=200000 THEN '100000-200000'
WHEN co_xslc > 200000 THEN '200000以上'
END AS xslc,COUNT(*)
FROM
pz_formatdata_fd
GROUP BY xslc