Fairly basic ; Invalid group function. i know i need to be using HAVING but not sure how to rewrite it.
update deals d
join deal_products dp on dp.deal_id = d.id
set d.products_count = count(distinct product_id)
where dp.active_flag=1 and dp.enabled_flag=1 and d.status != 'deleted';