LEFT JOIN logpm_distribution_loadscan AS ldl ON ldla.package_id = ldl.package_id
LEFT JOIN logpm_distribution_loadscan AS ldl ON ldla.package_id = ldl.package_id
LEFT JOIN logpm_distribution_parcel_list AS ldpl ON ldla.package_id = ldpl.id
LEFT JOIN logpm_distribution_parcel_list AS ldpl ON ldla.package_id = ldpl.id
WHERE
WHERE
ldla.reservation_id = #{reservationId} and ldla.delivery_list_id = #{deliveryListId} AND ldl.scan_status != 1
ldla.reservation_id = #{reservationId} and ldl.reservation_id = #{reservationId} and ldla.delivery_list_id = #{deliveryListId} AND ldl.scan_status != 1