left join logpm_basicdata_factory_category lbfc on lbfc.brand = ltad.brand and type=1
and IFNULL(lbfc.firsts,1) = IFNULL(ltad.first_pack_name,1) and IFNULL(lbfc.seconds,2) = IFNULL(ltad.second_pack_name,2) and IFNULL(lbfc.thirds,3) = IFNULL(ltad.third_pack_name,3) and IFNULL(lbfc.materiel_name,4)=IFNULL(ltad.material_name,4) AND lbfc.is_delete = 0
and IFNULL(lbfc.firsts,1) = IFNULL(ltad.first_pack_name,1) and IFNULL(lbfc.seconds,2) = IFNULL(ltad.second_pack_name,2) and IFNULL(lbfc.thirds,3) = IFNULL(ltad.third_pack_name,3) and IFNULL(lbfc.materiel_name,4)=IFNULL(ltad.material_name,4) AND lbfc.is_deleted = 0