SQL Server 2005 JOINing Slightly Different Tables
We have two tables, TableA and TableB that we wish to join on a common column. The only problem is that the data in that column varies slightly. In TableA it will be in the format UNIT_X while in TableB it will be in the format UNIT_X_B. There can be NULLS in the columns, but all other data will meet this format. There are a slew of other columns involved in the two tables, including some linked columns, but these are the ones that matter. When we tried creating another column in TableB that was the desired column SUBSTRING'ed down, SQL starts timing out, not due to too many returned rows but some other issue we can't nail down. Remove the reference to the new row and it works fine.
Any suggestions for JOINing these two tables?
Thanks in advance.
Re: SQL Server 2005 JOINing Slightly Different Tables
By TableA "in the format" do you mean the field format is always 4 characters, an underscore and 1 character? If yes,
Select Fields
From TableA Inner Join TableB On TableA.Field = Substring(TableB.Field,1,6)