SELECT
COUNT(DISTINCT pf.feature_id)
FROM
cscart_product_features AS pf
LEFT JOIN cscart_product_features AS pf_groups ON pf.parent_id = pf_groups.feature_id
LEFT JOIN cscart_product_features_descriptions AS pf_groups_description ON pf_groups_description.feature_id = pf.parent_id
AND pf_groups_description.lang_code = 'en'
LEFT JOIN cscart_product_features_descriptions ON cscart_product_features_descriptions.feature_id = pf.feature_id
AND cscart_product_features_descriptions.lang_code = 'en'
WHERE
1
AND pf.feature_type != 'G'
AND pf.status IN ('H')
AND (
pf_groups.status IN ('H')
OR pf_groups.status IS NULL
)
AND pf.parent_id = 651