Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics 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
  #1 (permalink)  
Old January 31st, 2005, 08:25 AM
Authorized User
 
Join Date: Dec 2004
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jaywhy13 Send a message via Yahoo to jaywhy13
Default More than one join

Can someone show me an example of using two joins in ONE sql statement.

I need to join the first two tables based on a primary key, and the third table will b joined to the second based on a different primary key....

Can someone give me a simple/quick example of how this could be done.
The first and second should be a LEFT JOIN because a record that is in the first table may or may not be in the second.

Thanks in advance

I'm gonna download the internet if its the last thing I do....
Until the algorithm is finished u must prepared to bow down and worship me (or my grave).... i figured i'll b finished b4 the latter!
__________________
I\'m gonna download the internet if its the last thing I do....
Until the algorithm is finished u must prepared to bow down and worship me (or my grave).... i figured i\'ll b finished b4 the latter!
  #2 (permalink)  
Old January 31st, 2005, 11:17 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

SELECT <fields> FROM <TABLE1>
LEFT JOIN <TABLE2> ON TABLE1.PK1=TABLE2.PK2
LEFT JOIN <TABLE3> ON TABLE2.FK2=TABLE3.PK3 -- just keep adding lines like this for more tables
  #3 (permalink)  
Old January 31st, 2005, 11:38 PM
Authorized User
 
Join Date: Dec 2004
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jaywhy13 Send a message via Yahoo to jaywhy13
Default

Can two joins be made on a pk in say table one. can i do like a double inner join so that table 2 and table 3 both do a left join on table 1?

I'm gonna download the internet if its the last thing I do....
Until the algorithm is finished u must prepared to bow down and worship me (or my grave).... i figured i'll b finished b4 the latter!


Similar Threads
Thread Thread Starter Forum Replies Last Post
I'm new to join oneilsteven BOOK: ASP.NET Website Programming Problem-Design-Solution 0 February 9th, 2008 06:07 PM
join dhara_adh SQL Server 2000 2 January 2nd, 2007 12:39 AM
Join or not join madhukp SQL Server 2000 3 February 2nd, 2005 01:11 AM
INNER JOIN msmagied Classic ASP Databases 3 August 29th, 2004 12:28 PM
Oracle 8i inner join and left join problem puteri_84 Oracle 2 August 19th, 2004 07:14 AM





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