I have a table (AmenityData) of data, and the column of this table contains mail agents, for example. E14 7
I also have an Excel spreadsheet with a list of postal counties, for example. E14
I need to get all the data from the AmenityData table, where the postal areas are AS the postal sectors, for example. WHERE [PostalDistricts] + '%' LIKE [PostalSector].
The code I'm using at the moment does not appear with an error, but just returns nothing, and I know that a lot of results should come out:
SELECT * FROM AmenityData As a
INNER JOIN OPENROWSET ('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=\\Bdzserver\db_creation\postaldistricts.xls;HDR=YES', 'SELECT * FROM [Sheet1$]') As b
ON b.[PostalDistricts] + '%' LIKE a.[PostalSector]
I'm not even sure that you can join tables using LIKE, I have never done this before.
source
share