I have in my SQL table about 5000 rows. I have two columns 'name1' and 'name2'. And now, tricky part. I have to data from 'name1' put into 'name2' and data from 'name2' should be in 'name1'... I know that I can make extra column just for this action but I have a feeling that is a better and faster way to do it. Important part that I cannot do it for all the rows but for particular part (about 50%), simply for 'WHERE type = 'p' ' ;-)
- I deleted my answer following your clarification...Vadim– Vadim2014-01-21 12:33:02 +00:00Commented Jan 21, 2014 at 12:33
- Sorry that I firstly forgot about this part ;-) But your answer wasn't stupid. I just change columns names and later data from on of them just put into second (for this rows that I didn't want to affect second column was empty so I was able to do it). Although I'm still intereseting is there any way in SQL to make something like 'exchange' data from two columns ;-)Michal Olszowski– Michal Olszowski2014-01-21 12:36:57 +00:00Commented Jan 21, 2014 at 12:36
- have a look on this one. stackoverflow.com/questions/37649/…I kiet– I kiet2014-01-21 13:04:46 +00:00Commented Jan 21, 2014 at 13:04
Add a comment |