Deleteing Records with 2 foreign keys

sql
mysql

#1

Hi I have 3 tables

Customer
- cust_id
- name

Products
- product_id
- product

Orders
- 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`ordersibfk_1FOREIGN KEY (cust_id) REFERENCESdata(cust_id`))_
because I can't delete the foreign keys. How can I inner join the tables to help delete the records


#2

You need to learn about ON DELETE CASCADE


#3

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