create join on two fields containing prefixes

dalerguy

Board Regular
Joined
Mar 2, 2005
Messages
51
Hello,

I have two tables that have related data except each field has a prefix. Table 1 has an A and Table 2 has a R. The other numbers are the same. How do I create an equal join on these two fields.



Table1
OrderNumber
A1234567890
A9876543210
A54321
A678901234

Table2
OrderNumber
R1234567890
R9876543210
R54321
R678901234
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Ended up using MID which will allows me to join on OrderNumber

SELECT DISTINCT [authorization transactions].[Order Number], [authorization transactions].[Credit Card Type], [authorization transactions].StudentID, [authorization transactions].[Customer Name], [authorization transactions].[Customer Address], [authorization transactions].[Customer City], [authorization transactions].GivingAs, [recuring transactions].[Order Number], [recuring transactions].[Transaction Date], [recuring transactions].[Transaction Amount]
FROM [authorization transactions], [recuring transactions]
WHERE (((Mid([authorization transactions].[Customer Name],1,Len([authorization transactions].[Customer Name])))=Mid([recuring transactions].[Customer Name],1,Len([recuring transactions].[Customer Name]))));
 
Upvote 0
Ignore posted sql. references. I didn't look before i posted. oops.

here is what I used:
SELECT DISTINCT [authorization transactions].[Order Number], [authorization transactions].[Credit Card Type], [authorization transactions].StudentID, [authorization transactions].[Customer Name], [authorization transactions].[Customer Address], [authorization transactions].[Customer City], [authorization transactions].GivingAs, [recuring transactions].[Order Number], [recuring transactions].[Transaction Date], [recuring transactions].[Transaction Amount]
FROM [authorization transactions], [recuring transactions]
WHERE (((Mid([authorization transactions].[Order Number],2,Len([authorization transactions].[Order Number])))=Mid([recuring transactions].[Order Number],2,Len([recuring transactions].[Order Number]))));
 
Upvote 0

Forum statistics

Threads
1,221,893
Messages
6,162,659
Members
451,780
Latest member
Blake86

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top