kalster Posted June 21, 2013 Share Posted June 21, 2013 i need to change only one fieldĀ by swap and keep the rest of the values for those rows. for example, x in row one has a value of 2 and the x in the other row has a value of 3. i need to swap only x for those rows. UPDATE swap_test SET x=(@temp:=x), x = y, y = @temp; Quote Link to comment Share on other sites More sharing options...
Barand Posted June 21, 2013 Share Posted June 21, 2013 Use the rows' primary keys to identify which x should get which value Quote Link to comment 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.