Skip to content
Advertisement

Copy text and find corresponding match to insert in another table [postgreql]

I try to migrate an existint text field into a many-to-many relationship.

I would like to insert in offer_work_days the correspondences to have this result

How can I achieve this with sql (on postgres)?

Advertisement

Answer

demo:db<>fiddle

You have to JOIN the tables on the text column, return only the id columns and insert the result into your new table.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement