SELECT count(1) FROM hygf_acceptance_rectification_order aro WHERE aro.peasant_household_id = bga.peasant_household_id
), 0) AS rectificationOrderCount,
ifnull((
SELECT aro.rectification_status FROM hygf_acceptance_rectification_order aro WHERE aro.peasant_household_id = bga.peasant_household_id ORDER BY rec_date DESC LIMIT 1
), 0) AS rectificationStatus
FROM
hygf_basic_grid_acceptance bga
LEFT JOIN hygf_peasant_household ph ON ph.sequence_nbr = bga.peasant_household_id
WHERE
bga.is_delete = 0
AND bga.acceptance_status IS NOT NULL AND bga.acceptance_status != ''