I'm trying to pull data from a large table and then join it to another table to get a list of addresses. Here's my issue: in my first table there are two columns, ADDRKEY and PRCLKEY, which both contain the same information. However, for some reason ~80% of the entries have this "address identifier number" in the ADDRKEY field with the PRCLKEY equal to 1 while the other 20% have the "address identifier number" in the PRCLKEY field and the ADDRKEY field entered as 1.
I need a way to use only the real identifier (non 1) from either column in Table1 and join to Table2 on T2.ParcelID = T1.(ADDRKEY or PRCLKEY if > 1)
Table2 on T2.ParcelID = Case When T1.ADDRKEY > 1 Then T1.ADDRKEY Else PRCLKEY End