Hi all,
I have a table (AmenityData) of data and a column of this table contains postalsectors e.g. E14 7
I also have an Excel spreadsheet with a list of postal districts e.g. E14
I need to get all the data out of the AmenityData table where the postal districts are LIKE the postal sectors e.g. WHERE [PostalDistricts] + '%' LIKE [PostalSector].
The code i'm using at the moment is not coming up with an error but just returning nothing and i know that there should be plenty of results returned:
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 if you can join tables using a LIKE, i've never done this before...
Thanks for any help.
J.