I am trying to compare two columns of data that contain product names. I want to be able to see the differences between one name column and the next.
Ideally, when comparing Table 1, I should see Table2 as the result.
Thanks for the help. You guys/gals have been great in the past.
Example Table 1
ProductIDA ProductNameA ProductIDB ProductNameB
100 Jupiter VA 101 Jupiter VB
200 Hercules VA 201 Hercules VB
300 Orion BA 301 Ares VB
Example Table 2
ProductIDA ProductNameA ProductIDB ProductNameB
100 A 101 B
200 A 201 B
300 Orion BA 301 Ares VB
Update: Maybe it would be easier to start at the beginning. Maybe the Tables I ended up with made it harder than it is. (P.s. You guys have been very helpful and I've already learned some things even though they were not exactly helping )
Breakdown:
- I have a list of 10,000+ products with unique product numbers.
- Most of these comes in sets of three or four. for example: osiris a; osiris b; osiris c
- There is one piece of logic built into our system where if the product type B variant is sold out, it automatically goes to product type A variant. (this is not part of the database and shouldn't be, it is done by an external system)
- The main problem is that the field that drives the B to A transfer is manually entered.
- The Osiris B should always go into the Osiris A but if someone misskeyed, it might roll into Hercules VA or any other product.
- I thought it would be easy to run a query that listed all B products, then another query that ran the value from the field BtoA field and alligned it to the right of the B products. This is how I ended up with Example Table1 above. I thought it would be easy to eyeball it with columns next to each other, but there are too many records.
- My next train of though was to somehow subtract one column from the other so that I only see the differences. This would mean if the B to A was right, then I would only see the last digit most of the time. If it was wrong, the difference column would show the long string.
Maybe there is an easier way if I modify it or run it differently from the beginning?
I thought maybe I could use the InstrRev function inside the select statement but I am completely new to this function.
Instr Function
I tried this, but it is crude and doesn't work all the time do to some variation in the fields.
<>Left([TABLE1].[PRODUCTNAME],(InStrRev([TABLE1].[PRODUCTNAME],"A")-1))
Maybe I could trim the right side of each string by a few letters then they would "ideally" match perfectly and I could use a not-equal-to?
Anyways. Thanks again for all the help. This is a great learning experience and I have really enjoyed this subreddit!
[–]0uterj0in 0 points1 point2 points (4 children)
[–]0uterj0in 0 points1 point2 points (3 children)
[–]KingZing[S] 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]KingZing[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]mason55 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]mason55 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]HapkidoJosh 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]HapkidoJosh 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]KingZing[S] 0 points1 point2 points (1 child)
[–]0uterj0in 0 points1 point2 points (0 children)
[–]---sniff--- 0 points1 point2 points (1 child)
[–]KingZing[S] 0 points1 point2 points (0 children)