• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

MySQL question...multi table deletes.

Entity

Lifer
Ok, I have two tables that I'm working with: tblUser and tblUserRegion.

tblUser has userID, userEmail, userAddress.

tblUserRegion has userRegionID (PK), userID and userRegion. it has a 1:n ration between userID and userRegion...there is a separate entry for each region a user is part of.

Using foreign keys is unfortunately not an option with this MySQL setup. So: when I delete a user from tblUser, I'd like to make sure that all mentionings of them get deleted from tblUserRegion as well.

Trying something like this:

DELETE tblUsers, tblUserRegions FROM tblUsers, tblUserRegions WHERE tblUsers.UserEmail="email@email.com" AND tblUsers.UserID=tblUserRegions.UserID

But it doesn't seem to be right. Any advice?

thanks,
Rob
 
Back
Top