• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 235
  • Last Modified:

2 left joins and an INNER

i have a couple left joins -- to which i need to add an inner join  -- and i'm not at all sure about they syntax, or even the integrity of something like this

---current:  
select   blah blah blah
from database.dbo.TradeTable tr
  left join lflagtranslate lft
       on tr.lflag = lft.lfag
  left join symbolstuff sdd
      on tr.symbol like sdd.symbol
......
....

i need to inner join the TradeTable to the EGroups table for a list of endpoints, like this:

--need to add
select blah blah blah
from database.dbo.TradeTable tr INNER JOIN
server2.database.dbo.egroups eg
  on tr.endpoint = eg.endpoint
  and eg.egroup = 'AAAA'

what's the correct way to combine the three?  ( 2 left joins and the inner )
0
dbaSQL
Asked:
dbaSQL
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
select   blah blah blah
from database.dbo.TradeTable tr
  left join lflagtranslate lft
       on tr.lflag = lft.lfag
  left join symbolstuff sdd
      on tr.symbol like sdd.symbol
INNER JOIN server2.database.dbo.egroups eg
  on tr.endpoint = eg.endpoint
  and eg.egroup = 'AAAA'

0
 
dbaSQLAuthor Commented:
oh my goodness, angell.  pretty darned easy... i was thinking i needed the inner up top, and i had done exactly the reverse of yours

thank you much
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now