Q

Joining more than two tables

I am creating a report using SQL Server 7 Query Analyzer. I mainly work with Oracle SQL, which has a slightly different syntax. I have three tables and want to return all matching rows from the tables. Using JOINS I can join two tables together, but I am not sure how to join three tables in MS SQL. This statement is what I am trying to achieve:
 SELECT c.profilename, c.loginuser, s.company, s.product , s.filedescription, i.systemserialnumber FROM hstcomputers C FULL OUTER JOIN sigsoftware S, hstIdentification i ON c.id = i.id AND s.sigid = i.sigid
I know the third table in the FROM is the wrong syntax, but I am not 100% sure how it should be, as everything I have read is based around joining two tables.

 

 Select columns From table1 inner join table2 on table1.col1 = table2.col2 Inner join table3 on table1.col1 = table3.col2 Inner join table4 on table2.col1 = table4.col5 Inner join table5 on table3.col1 = table5.col17
Etc.

 

For More Information

This was first published in July 2003

Dig deeper on Microsoft SQL Server Installation

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchBusinessAnalytics

SearchDataCenter

SearchDataManagement

SearchAWS

SearchOracle

SearchContentManagement

SearchWindowsServer

Close