SELECT (IF((SELECT sum(loaded_nub) FROM logpm_distribution_loadscan WHERE reservation_id = #{reservationId} AND scan_state != 1 AND is_abnormal_loading != 2) is null,0,(SELECT sum(loaded_nub) FROM logpm_distribution_loadscan WHERE reservation_id = #{reservationId} AND scan_state != 1 AND is_abnormal_loading != 2)))