Jump to content

1 Table 6 fields - concatenate into 3 sets, compare and replace where match


OldWest

Recommended Posts

Although I am deciding on the best route to go on this, I was hoping for any feedback or ideas on the best and simplest approach to the below problem:

 

 

Here is my table structure:

 

old_code_1

old_code_2

 

new_code_1

new_code_2

 

prod_code_1

prod_code_2

 

Each of the following fields has 5 digits e.g. 00045, 12654, etc.

 

What I need to achieve is this:

 

Concatenate each set (of the 3 sets above) data into one variable e.g. old_code_1 + old_code_2 = 0004512654. So old_code_1 & old_code_2 would become a combined data and the same for the othe 2 sets.

 

Then. Once concatenated, I need to compare: prod_code_1+prod_code_2 with old_code_1+old_code_2 and replace prod_code_1+prod_code_2 with new_code_1+new_code_2 where matches are found.

 

The new_code_1 & 2 are in the same row as the old_code 1 & 2. So the data is in alignment that way for comparison.

 

Thanks for any insight or suggestions on how to make this happen in the simplest form possible.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.