Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 22nd, 2005, 01:56 PM
Friend of Wrox
 
Join Date: Sep 2003
Location: Whitstable, , United Kingdom.
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




Reply With Quote
  #2 (permalink)  
Old February 22nd, 2005, 02:24 PM
Friend of Wrox
Points: 2,473, Level: 20
Points: 2,473, Level: 20 Points: 2,473, Level: 20 Points: 2,473, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2004
Location: India
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
Reply With Quote
  #3 (permalink)  
Old February 22nd, 2005, 07:13 PM
Authorized User
 
Join Date: Feb 2005
Location: Frankston South, Victoria, Australia.
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 04:53 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.