The best method for this is to write a small php script to query the old table and grab all the user id's and their corresponding usernames. Then store that in an array. Loop through the array and update the new table with the old id's. This is a little risky so be careful of what you do. The code below is a pretty good start to do what you want. Remember that you need to change the information for your database host, username, password, database name. You also need to make sure the right table and field names are used!
PHP Code:
/* Connect to your database */
mysql_connect("localhost", "username", "password") or die(mysql_error());
mysql_select_db("test") or die(mysql_error());
/* Create array for old id's and query the database for all the old id's */
$old_ids = array();
$result = mysql_query("SELECT user_id, username FROM users");
/* Store all old id's with their corresponding username */
while ($row = mysql_fetch_row($result)) {
$old_ids = array('user_id' => $row['user_id'], 'username' => $row['username']);
}
/* Update every user that existed in the old table with their old user id number */
foreach ($old_ids as $old_id) {
mysql_query("UPDATE table_name SET user_id=".$old_id['user_id']." WHERE username=`".$old_id['username']."`")or die(mysql_error());
}