This simple sql query deletes the all the records that don't have a corresponding ID in another table.
#delete orphaned descriptions of the products
DELETE b FROM `oc_product_description` b LEFT JOIN `oc_product` a ON b.product_id = a.product_id WHERE a.product_id IS NULL
#delete orphaned descriptions of the products
DELETE b FROM `oc_product_description` b LEFT JOIN `oc_product` a ON b.product_id = a.product_id WHERE a.product_id IS NULL
Comments
Post a Comment