Update / Delete on Joined Tables |
Hey All,
I have tried searching everywhere and none of the solutions seem to work. I'm using CIv3 with a MySQL back end. Below is a simple outline of the issue. Table 1 - Character PK: ID Some Data Field Foreign Key: party_id Table 2 - Party PK: ID Some Data fields user_id So the character table links to the party table like so: character.party_id = party.id And I only want to update (or delete from) the Character table *IF* the supplied user ID to the model function matches the user_id in the Party table. My MySQL is a little rusty, but in MSSQL it would look like: Code: update c Some solutions I've tried without success: https://forum.codeigniter.com/thread-637...pdate+join https://stackoverflow.com/questions/4830...pdate-quer https://stackoverflow.com/questions/3197...using-join https://stackoverflow.com/questions/9578...ith-a-join https://developer-paradize.blogspot.com/...using.html I really don't want to have to hand-write SQL code, nor do I want to do an initial "select" query to make sure the user is linked to the correct party to be able to update (or delete) this entry. I'm sure I'm missing something simple with this. |
Messages In This Thread |
Update / Delete on Joined Tables - by Gazman Development - 02-13-2021, 09:42 PM
RE: Update / Delete on Joined Tables - by demyr - 02-14-2021, 10:04 AM
RE: Update / Delete on Joined Tables - by InsiteFX - 02-14-2021, 12:06 PM
RE: Update / Delete on Joined Tables - by Gazman Development - 02-20-2021, 05:08 PM
|