I have the following sql statement:
select A.transactionNumber,
A.DealNumber
A.Group
from TableOne A
inner join TableTwo B
on A.transactionNumber = B.tranNumber
where B.ID = 111111
this yields something like this
transactionnumber | DealNumber | Group
123 | 1 | 100
456 | 2 | 101
However, there's another table, tableThree, that translates the 'Group' into a string. It looks like this:
Group | GroupLookup
100 | Lookup1
101 | Lookup2
102 | Lookup3
So in summary, I'd like my select to return this:
transactionnumber | DealNumber | Group
123 | 1 | Lookup1
456 | 2 | Lookup2
I'm entirely sure that this is simple, however I'm a complete newbie and the presence of the first join in the select is throwing me, I'd very much appreciate any help.
If I correctly understood should be something like:
select A.transactionNumber,
A.DealNumber,
C.GroupLookup AS [Group]
from TableOne A
inner join TableTwo B
on A.transactionNumber = B.tranNumber
inner join TableThree C
on C.Group = A.Group
where B.ID = 111111
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.