i have table category_master(cat_id(pk),category_name,active)
and sub_category table with fields(sub_cat_id(pk),category_id,sub_category_name,active)
now what i want is count number of active sub categories having value=1 if this count is 0 then update active=0 in category_master table
i have been trying this but no go,can anyone help me in this?
SELECT active,category_id, count( * ) AS 'Cnt'
FROM gy_sub_category
WHERE active =0 if (Cnt='0') then set active=1
trying this but no success how can i achieve above??