Q:

sql query to delete parent table rows which are not used in child table

my question title saying exactly what i want help.
Table defination & relation:

I tried this below query but its not delete the data "jl" from measuring_units table. I want to delete that row with 62 in "measuring_units" table, because it is not being used in "food_units_relation" table
this one i tried:
DELETE  t2
        FROM food_units_relation t1 JOIN measureing_units t2
        ON t1.measuring_unit_id = t2.measuremnt_id
        WHERE t1.foodUnit_relation_Id = 17 and  t2.measuremnt_id NOT IN(t1.measuring_unit_id) and t2.creater_id=1;

A:

DELETE  t2
FROM measureing_units t2
LEFT JOIN food_units_relation t1 ON t1.measuring_unit_id = t2.measuremnt_id
WHERE t1.foodUnit_relation_Id = 17 and t1.measuring_unit_id is null and t2.creater_id = 1;

