I have 2 tables, one is a table of parameters that the other table can have, and they’re stored like this:
Table 1
id name
1 var1
2 var2
3 var3
Table 2
id name parameters
1 name1 var1|var3
2 name2 var2
3 name3 var1|var2|var3
Now, when I run a DELETE query, I want to update table 2 parameters aswell, so let’s say I run a DELETE query on table 1, row 1, I want to get the following table 2 result, should I query for it:
Table 2
id name parameters
1 name1 var3
2 name2 var2
3 name3 var2|var3
Any help would be appreciated, Thanks
You should restructure your tables. Normalized data modelling would tell you to use an n-to-m table structure (many-to-many or junction). So create a third table which has all references to both of your tables and resides in between your current two tables.