LEFT JOIN logpm_distribution_reservation_package AS ldrp ON ldr.id = ldrp.reservation_id
LEFT JOIN logpm_distribution_parcel_list AS ldpl ON ldrp.parce_list_id = ldpl.id
LEFT JOIN logpm_distribution_loadscan AS ldl ON ldl.package_id = ldpl.id AND ldl.is_abnormal_loading = 1 AND ldl.scan_status != 1
LEFT JOIN logpm_distribution_loadscan AS ldl ON ldl.package_id = ldpl.id AND ldl.is_abnormal_loading = 1 AND ldl.scan_status != 1 AND ldl.reservation_id = ldr.id