This is the relationship between several tables:
tblProducts : List of products.
tblProcesses : Holds 30 records for all possible processes we can handle for manufacturing a product.
tblProducts_Processes : A junction table between these two tables. (Each product needs which process)
tblOrders_Processes : a table to keep track of the date and the person in charge who has worked on the necessary processes for each order.
I can use the following sql to insert all necessary processes from tblProducts_Processses into tblOrders_Processes
Two questions:
Thanks for any kind of advice.
tblProducts : List of products.
tblProcesses : Holds 30 records for all possible processes we can handle for manufacturing a product.
tblProducts_Processes : A junction table between these two tables. (Each product needs which process)
tblOrders_Processes : a table to keep track of the date and the person in charge who has worked on the necessary processes for each order.
I can use the following sql to insert all necessary processes from tblProducts_Processses into tblOrders_Processes
SQL:
INSERT INTO tblOrders_Processes ( OrderFK, ProcessFK )
SELECT 12, ProcessFK
FROM tblProducts_Processes
WHERE ProductFK=2;
Two questions:
- Is there any way to simplify this query? As OrderPK=12 has only one ProductFK, is there any way to change the sql somehow that works only with OrderPK?
- This sql inserts only one OrderFK at a time. (above example -->12). Is there any way to make it work for multiple OrderPKs? For example OrderPK from 12 to 15.
Thanks for any kind of advice.
Attachments
Last edited: