Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access 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 February 22nd, 2005, 01:56 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
Default joins on more than 2 tables

hi,

 i am a beginner so please bear with me...thanks

  i can do a simple join quert on 2 tables eg

   "select id, name, address, payroll_number, pay_scale
    from personnel join payroll on [personnel].id=[payroll].id"

  BUT...
    what if i need to get further information from another
    table ( ie a 3rd table ) and also join on the id field ?

  If this makes sense - could anyone kindly give me a code example
  as i cannot find one in any book. The code examples i have
  only do joins on 2 tables at a time.

  Many thanks for any replies.

  Chas. UK




 
Old February 22nd, 2005, 02:24 PM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

You can have 3rd join as:

"select id, name, address, payroll_number, pay_scale
    from personnel join payroll on [personnel].id=[payroll].id
     join table3 on table3.id = [payroll].id "



Om Prakash
 
Old February 22nd, 2005, 07:13 PM
Authorized User
 
Join Date: Feb 2005
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hy badgolfer will the third table will be liked to the same primary key as the other table or with another field.

What I mean is, for instance, if the two tables are linked with a CustomerID (primary and foreign key), is the third table also linked to CustomerID or say, for instance, a Projects table?

See what I say? BTW are you using Access to create your query?

There are a few possibilities here:

CustomersTable -> ProjectsTable -> EmployeesTable

Where each Customer has many Projects and each Project uses many Employees. Get it?

CustomersTable -> ProjectsTable
CustomersTable -> EmployeesTable

Where each Customer has many Projects as well as many Employees.

So tell us about your design a little bit.

Daniel





Similar Threads
Thread Thread Starter Forum Replies Last Post
What are joins? Bhalchandra SQL Server 2000 2 July 2nd, 2007 11:29 PM
Joins for multiple tables Jinn SQL Server 2000 2 November 5th, 2006 11:39 PM
Joins nalla Oracle 0 December 14th, 2005 05:54 AM
Joins r_ganesh76 SQL Server 2000 2 February 10th, 2005 12:21 AM
Joins marthaj SQL Server 2000 7 June 26th, 2003 09:02 AM





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