Ask the Expert

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.

    Requires Free Membership to View

 

 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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

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: