Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Multiple Left Joins

Author  Topic 

jmcbride
Starting Member

24 Posts

Posted - 2003-06-09 : 11:55:38
I have 3 tables that I would like to join:
Offices
Address
Links

The Offices table contains refrences to the addresses and links table in a one to many relationship.

Using the OfficeID, I would like to select one office, even if the office does not have an associated link or address. I assume that this will use a left join of some type but am unsure how to go about doing 3 tables.

--------------------
http://www.utsa.edu/
(Joe) Joseph McBride

nr
SQLTeam MVY

12543 Posts

Posted - 2003-06-09 : 12:04:15
select *
from Offices o
left outer join links l
on l.office_id = o.id
left outer join Addresses a
on a.id = l.address_id
where o.d = @id


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -