LEFT JOIN qc_sampling_inspection_level as qsil ON qat.sampling_level_no = qsil.sampling_level_no and qat.site = qsil.site and qat.bu_no = qsil.bu_no
LEFT JOIN qc_inspection_type as qit ON qt.inspection_type_no = qit.inspection_type_no and qt.site = qit.site
LEFT JOIN qc_sampling_inspection_programme as qsip ON qat.sampling_programme_no = qsip.sampling_programme_no and qat.site = qsip.site and qat.bu_no = qsip.bu_no
WHERE qat.site = #{site} and qpa.attribute_type = #{attributeType} and qpa.attribute_no = #{attributeNo} and qat.bu_no = #{buNo}
<where>
qat.site = #{site} and qpa.attribute_type = #{attributeType} and qpa.attribute_no = #{attributeNo} and qat.bu_no = #{buNo}
<iftest="inspectionTypeNo !=null and inspectionTypeNo != ''">