UPDATE friends INNER JOIN users ON friends.friendid=users.useridSET friends.friendname=users.username