Hi everyone, I have a table TableCthat stores primary key values ββfrom two different tables TableAand TableB. because they are the primary keys from two tables, I could get duplicates in this TableC, so when I save the values, I prefix the Primary keys with short text to distinguish what the value comes from this table.
Now I would like to join this TableCwith TableAand TableBto get the data from TableAandTableB
TableC :
ID_Column
1A
1B
2A
TableA:
ID_Column | Data
1 | data A 1
2 | data A 2
3 | data A 3
TableB:
ID_Column | Data
1 | data B 1
2 | data B 2
3 | data B 3
This is what I tried to do.
select C.ID_Column, data
from tableC C
inner join tableA A
on A.ID_Column = left(C.ID_Column, 1)
inner join tableB B
on B.ID_Column = left(C.ID_Column, 1)
. b, ID_Column B TableA, ID_Column A
.