Understanding your query is certainly a challenge - I read your question twice and still can't work out what you want. You'll get a better standard of response if you just post a few examples of what you need.
You've changed your original query but it really isn't any clearer to me. Does the string you want moving always start in exactly the same position or is it after a certain pattern is found in the original string? If you post a few examples then this will be quite clear and I can help you. If you can't then I suggest you go to the manual page on MySQL string functions and look up instr and substr.
Cell value of ColumnA, row1: vvvvv ssssss yyyyy tttttt
Cell value of ColumnA, row2: 1234 xyz ssssss Dbforums is awesome.tttttt
Cell value of ColumnB, row1: uuuuuuu
Cell value of ColumnB, row2: append tothe endofthis
Run query. Result:
Cell value of ColumnA, row1: vvvvv
Cell value of ColumnA, row2: 1234 xyz
Cell value of ColumnB, row1: uuuuuuu ssssss yyyyy tttttt
Cell value of ColumnB, row2: append tothe endofthis ssssss Dbforums is awesome.tttttt
So, note that ssssss and tttttt remain unchanged before and after the query in both rows. They and the second set of variable text no longer remain in ColumnA, row1 and row2. And the designated values are moved to ColumnB, row1 and row2.
I'm not playing a game here. Please respect that this a matter of us understanding each other in good faith...
I'm trying to explain that the variable values are different in every row. Let's put it this way: In the place of vvvvv and yyyyy are random characters. Will your query work if those values are random in each row?
Will your query work if those values are random in each row?
Yes of course - assuming the random characters don't contain spaces. I suggest you copy the tables you're doing the work on. Then run the supplied updates on the new tables and see if everything is fine. Then run the updates on the main table.
Assuming two things, I find the string operation easy. First, ssssss occurs only once in the field. Second, tttttt marks the end of the field. In other words, there is no more than one ssssss or tttttt. When you find tttttt in the field, that's the end of the field.
To begin with, you should find out what part you want to keep intact from the older field:
No, ssssss occurs only in some rows in ColumnA. Likewise, tttttt occurs and marks the end of only some rows in ColumnA. I only want the query to be activated in those rows where ssssss and tttttt occur.