Reputation: 1223
i have these two tables.
The first is the users_details table
Second is the users_posts table.
i want to fill the column postedby_name with username from the first column.
I tried a combination of inner join and sub-query but could not do it.
This is the code that i have now.
update users_posts
set users_posts.postedby_name =
(select username from users_details inner join users_posts where
users_posts.postedby = users_details.id);
How to Accomplish this.?
Upvotes: 0
Views: 330
Reputation: 8109
Update users_posts inner join users_details
on users_posts.postedby = users_details.id
set users_posts.postedby_name=users_details.username
Upvotes: 4