Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 5th, 2006, 08:44 PM
Registered User
 
Join Date: Oct 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Joins for multiple tables

I can't seem to figure out how to join 3 tables together and I can only find examples of joining two tables.

What I need is to join Table_1 to Table_2 to Table_3, in order to get data from Table_1 and Table_3.

How can I do this?

 
Old November 5th, 2006, 09:33 PM
SQLScott's Avatar
Wrox Author
 
Join Date: Dec 2004
Posts: 338
Thanks: 0
Thanked 2 Times in 2 Posts
Default

select table1.blah, table3.blah
FROM table1
inner join table2 on table1.column = table2.column
inner join table3 on table2.column = table3.column

preferably using pk/fk relationships for "column".


Scott Klein
Author - Professional SQL Server 2005 XML
http://www.wrox.com/WileyCDA/WroxTit...764597922.html
 
Old November 5th, 2006, 11:39 PM
Friend of Wrox
 
Join Date: Oct 2006
Posts: 475
Thanks: 0
Thanked 9 Times in 9 Posts
Default

Scott's got it.... spot on, too, about the pk/fk relationship if at all possible.

--Jeff Moden





Similar Threads
Thread Thread Starter Forum Replies Last Post
multiple sql joins in mySQL 5 Dean Lovell SQL Language 4 January 19th, 2007 02:43 PM
joins on more than 2 tables badgolfer Access 2 February 22nd, 2005 07:13 PM
Multiple Inner Joins msmagied Classic ASP Databases 0 October 6th, 2004 05:11 PM
Multiple Joins in Multiple Table Search query pookster Access 4 September 23rd, 2004 03:04 PM
multiple self joins and sum [email protected] SQL Language 3 May 25th, 2004 06:03 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.