haibec Posted September 8, 2006 Share Posted September 8, 2006 Hi all!I have two table USER1 includes field : ID, Username,Password and Table USER2 includes filed : ID ,Username,Name . When user register . Data will save into 2 that table . One reason or other, two filed ID on the two table not same but Username on the 2 table same . I want UPDATE all ID on the User1 = ID on the User2 .Please help meeeeeeeeeeee Link to comment Share on other sites More sharing options...
Cronthenoob Posted September 8, 2006 Share Posted September 8, 2006 You'll have to do something likeINSERT into table1 set id='id', username='username'SELECT id FROM table1 where username='requested_username'INSERT into table2 set id='table1_id' username='requested_username'I'm not sure about the syntax because i've only worked with PHP and MySQL. But the queries would look similar. Link to comment Share on other sites More sharing options...
bhavik_solanki Posted September 14, 2006 Share Posted September 14, 2006 Try This QueryUpdate User2 Set UId = User1.Uid From User1 Where User1.UserName = User2.UserName Link to comment Share on other sites More sharing options...
iyeru42 Posted September 14, 2006 Share Posted September 14, 2006 Try This QueryUpdate User2 Set UId = User1.Uid From User1 Where User1.UserName = User2.UserNameAssuming the person used the AS or LEFT JOIN deal of course. If not, that won't work since it'll say User1.uid is invalid, null or not an object. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now