Answer the question
In order to leave comments, you need to log in
How to write the following query?
Hey! There are two tables and a link between them. The tables are filled except for the connecting one. You need to write a code that will fill the linking table in this form (that is, it will pull data from two tables and insert it into the one that links, since there is a lot of data and it will take a very long time by hand):
--id_product--id_curencies--active--
--1 --1--1--
--1--2--1--
--2--1--1--
--2--2--1--
active - always 1.
Thank you!
UPD: Possibly?
Answer the question
In order to leave comments, you need to log in
insert into m2m_table select p.id, c.id, 1 from products as p join currencies as c;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question