How can we help without more detail? You're correct - to maintain database integrity you must delete all related records first. How to determine what records are related is the question here. You can use SELECT...WHERE to experiment, and when you get the result you like you can do DELETE...WHERE using the same WHERE clause.