I have been working on sql much more than I care to lately and I ran across a problem. I had a table that had 2 columns referencing the same table and I needed to do a join on each column seperately.
The solution:
select t1.id1, t2a.cell, t1.id2, t2b.cell
from table1 as t1
inner join table2 as t2a on t1.id1 = t2a.id
inner join table2 as t2b on t1.id2 = t2b.id;
Fairly simple after all…
0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.