mikeyca Posted December 27, 2008 Share Posted December 27, 2008 Hello, I have been confused on how I can do this. I have 2 tables in the same database. users & pollcomments In the users & pollcomments both have a userid and username field. I need to populate the username data from the users table into the pollcomments table if the userid in the pollcomments field equals the userid field in the users table. The poll table is populated and does contain the userid data, but currently the user field is blank for all the data in the table. Thanks, mikey mysql: 4.1.20 Quote Link to comment https://forums.phpfreaks.com/topic/138515-update-data-in-one-table-to-another/ Share on other sites More sharing options...
Gamic Posted December 28, 2008 Share Posted December 28, 2008 update pollcomments set username = u.username from pollcomments p inner join users u on p.userid = u.userid Quote Link to comment https://forums.phpfreaks.com/topic/138515-update-data-in-one-table-to-another/#findComment-724824 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.