I have two tables:
Table 1: Companies (id, name) Table 2: Holidays (id, companyId, name)
Currently companies table have data, but holidays doesn't. I want to iterate through all companies, get their ID's and insert two records in holidays for every company. So this would be before and after:
Before:
Companies
| id | name |
| 0 | test1 |
| 1 | test2 |
Holidays:
Empty table
After:
Companies
| id | name |
| 0 | test1 |
| 1 | test2 |
Holidays:
| id | companyId | name |
| 0 | 0 | holiday1 |
| 1 | 0 | holiday2 |
| 2 | 1 | holiday1 |
| 3 | 1 | holiday2 |