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
 General SQL Server Forums
 New to SQL Server Programming
 Joining more than two tables

Author  Topic 

duf
Starting Member

39 Posts

Posted - 2011-12-22 : 15:39:54
Hi, I`m newbie, I greet all the members.
Can I connect more than two tables in one query? How looks like query with inner join?

X002548
Not Just a Number

15586 Posts

Posted - 2011-12-22 : 15:42:59
SELECT * FROM Table1 INNER JOIN Table2 ON Table1.KeyCol = Table2.KeyCol

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

duf
Starting Member

39 Posts

Posted - 2011-12-22 : 15:47:15
Thanks, but it looks like two tables are joining. And how join three tables?
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2011-12-22 : 15:53:13
what are their relationships to each other?

Kind of hard to work in the dark here

SELECT * FROM Table1
INNER JOIN Table2
ON Table1.KeyCol = Table2.KeyCol
INNER JOIN Table3
ON Table1.KeyCol = Table3.KeyCol

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

duf
Starting Member

39 Posts

Posted - 2011-12-22 : 16:06:33
It seems that relationships are the same as in your example. I have to check and see what I get the results. Thank you again.
Go to Top of Page
   

- Advertisement -