I have a many-to-many table of products and models ids. Is it possible to insert new rows if the ids match in another row?
Example Table:
| p_id | m_id |
+------+------+
| A | 2 |
| A | 3 |
| B | 1 |
| B | 2 |
| C | 1 |
SQL Script:
If any product is related to model 2, insert new row of that product and product 4.
The table would become:
| p_id | m_id |
+------+------+
| A | 2 |
| A | 3 |
| A | 4 |
| B | 1 |
| B | 2 |
| B | 4 |
| C | 1 |
I have to do this in SQL. More specifically, Sequel Pro.