-
☆ A M B ☆
- 24,524 Posts
So if I want to replace all the usernames with their respective email addresses, there's a way to write a query to do it all in one go, right?
something like "update web_users set web_users.username = web_user_attributes.email where web_user_attributes.internalKey = web_users.id"
Makes my head hurt.
-
☆ A M B ☆
- 24,524 Posts
Got it! (Google is my friend)
UPDATE modx_web_users wu
SET username =
(SELECT email
FROM modx_web_user_attributes wua
WHERE wua.internalKey = wu.id)
More along the lines of what I was thinking originally, this also works:
UPDATE modx_web_users wu, modx_web_user_attributes wua
SET wu.username = wua.email
WHERE wu.id = wua.internalKey
[ed. note: sottwell last edited this post 14 years, 1 month ago.]