Jump to content

UPDATE COMAND !HELP ME


haibec

Recommended Posts

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

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

Try This QueryUpdate User2 Set UId = User1.Uid From User1 Where User1.UserName = User2.UserName
Assuming 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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...