Populating a column in one table with a column in another table

Ok, so here is my latest challenge. I store outgoing emails in a table called notifications. In that table is a column called recipient, which is an email address. I recently added a new column to the notifications table called userID. Since I have the receiver’s email address, I need to somehow get the userID from the user’s table, and add it to the userID of the notifications table. Can someone suggest a way this can be accomplished?


I think I found something on the web that will work. Does this look appropriate?

UPDATE notifications, users
SET notifications.userID = users.userID
WHERE notifications.userID = 0 and notifications.recipient = users.email;