I'm going to use the user import module to import several users from a different system. For reasons the UID of each user has to remain the same in the new site as in the old. The user ID is used for other purposes and there are hundreds of laminated cards with each users costumer ID out there.
I already tested the user import module and it works great except I can't find a way to map the unique costumer number to the new site's UID. My plan is to import the costumer ID by creating a field in the profile table called costumer ID and map it to the costumer number of the old database. After everything is finished I will manually write a SQL query and execute it in phpMyAdmin.
Right now there is only user 1 in the database (and some test users which will be erased). I want to then change each UID to the customer ID. I opened phpMyAdmin and changed one of my test user's uid. This is the query phpMyAdmin came up with.
UPDATE `horton79_a`.`users` SET `uid` = '14' WHERE `users`.`uid` =20 LIMIT 1 ;
Within the database that is being imported both the email address and customer ID are unique. I don't know how to use that to my advantage, but I do know it is a good thing. I'm going to start by trying to write a query, but I don't know anything about SQL. The fid is the field id of the custumer ID that is being imported by the user import module. This is my first attempt at writing an sql query, ever, so I'm just guessing what it might look like. What do you think? And, how do I make it work?
UPDATE 'horton79_a'.'users' SET 'uid' = 'profile_values'.'value' WHERE ('users'.'uid' = 'profile_values'.'uid' AND 'profile_values'.'fid' = 26);
Comments
Use this query UPDATE users
Use this query
UPDATE users INNER JOIN profile_values on users.uid = profile_values.uid AND profile_values.fid = 10 SET users.uid = profile_values.valueit didn't work. Here is the
it didn't work. Here is the error.
Your query does work.
Your query does work. However, I have to make sure that all the imported users have high uid than the number of the customer ID or else there are during the process two different users with the same ID while the process sorts it out.
The issue now is updating the
The issue now is updating the UID in the profile_values table. Every value for uid that is 55802 needs to change to 93 the value of the row with fid = 32.
Ok, now I made a new table in
Ok, now I made a new table in the database called profile_switch which I'm hoping can take the first UPDATE query and change the profile_values table with it. I created the table in phpMyAdmin. Here is the query:
Here is the query to make the switch
BAM!!!! It worked....... I can't even tell you how high I am right now.