Hello I have three tables:
Departments(ID int, name varchar(20));
Products(ID int, name varchar(20), department_id int);
Sales(ID int autoincrement, salesdate date, product_id int, department_id int);
Created foreign key for Sales:
PRIMARY KEY (
sales_product_id_foreign FOREIGN KEY (
department_id) ON DELETE CASCADE
When I select particular department_id in Sales, and afterwards when I select product_id in Sales, I get list of all products, not only filtered by specified department_id in table Sales.
Is it possible only to get related products from table Products based on selected department_id in table Sales?