I'm trying to join Table1 and Table2 on the Url fields. However all the Urls in Table2 end with a "/" as per the example below:
Table1
╔═════════════════════╗ ║ Url1 ║ ╠═════════════════════╣ ║ http://site1.com ║ ║ http://site2.com ║ ║ http://site3.com ║ ║ http://site4.com ║ ║ http://site5.com ║ ╚═════════════════════╝ Table2
╔═════════════════════╗ ║ Url2 ║ ╠═════════════════════╣ ║ http://site1.com/ ║ ║ http://site2.com/ ║ ║ http://site3.com/ ║ ║ http://site4.com/ ║ ║ http://site5.com/ ║ ╚═════════════════════╝ I'm using a SUBSTRING to remove the final character from the Url2 field. This is what my query looks like:
SELECT Table1.Url1, SUBSTRING(Table2.Url2, 1, LEN(Table2.Url2) - 1) AS Urlx FROM Table2 LEFT JOIN Table1 ON Urlx = Table1.Url1 However I cannot get the Urlx field in the LEFT JOIN clause to resolve.
Is it possible to join tables on a manipulated field or have I constructed my query incorrectly?