I'm having trouble finding documentation on how to do joins with many tables with varying relationships involved. In the following sql statement how does the interpreter know what is being joined with what, simply by the on phrases?
select m.lnkey, isnull(rtrim(b.borr_last),'')+', '+isnull(rtrim(b.borr_first),'')+' '+isnull(b.borr_middle,'') as borrname,
m.loanamt, m.prog, m.intrate, r.name as brokername, a.agentname, p.prop_state, g.location, g.property, g.occupancy, g.income
from empower.mtgterms as m
join empower.propinfo as p on m.lnkey=p.lnkey
join empower.gradeprice as g on m.lnkey=g.lnkey
join empower.borrinfo as b on m.lnkey=b.lnkey
join empower.brokeragents as a on m.agentid=a.id
join empower.brokerages as r on a.brokeracct=r.id
join empower.lendinfo as l on m.lenderid=l.id
where l.id='1' and b.whichborr=1
or does the ordering of the joins also play into this?
This statement seems to work in that I basically need inner joins for this report, but is it the best way to achieve such a thing?
TIA