mysql column values add up to null

Sometimes there will be a case where the columns behind the select are added. When one of the values ​​is empty, it returns directly. In such a case, ifnull is added

SELECT

ifnull(
SUM(
dispatch_fee + fuel_fee + road_fee
),
0
)
FROM
t_busi_station_exc
Published 12 original articles · praised 7 · 20,000+ views

Guess you like

Origin blog.csdn.net/tl1242616458/article/details/78153388