Deleteing Records with 2 foreign keys

Hi I have 3 tables


  • cust_id
  • name


  • product_id
  • product


  • order_id
  • cust-id
  • product-id

I’ve set up 2 list boxes which show customer and products. If the user selects the correct data then they can delete the record from orders table. I can’t seem to do so and I get an error> QUERY FAILED .Cannot delete or update a parent row: a foreign key constraint fails (customer.orders, CONSTRAINT orders_ibfk_1 FOREIGN KEY (cust_id) REFERENCES data (cust_id))
because I can’t delete the foreign keys. How can I inner join the tables to help delete the records

You need to learn about ON DELETE CASCADE

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.