Results 1 to 3 of 3
  1. #1
    dhogan444 is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Jan 2011
    Posts
    12

    Join Statement with two field relationship

    Hello, here is the problem:



    We have two tables;

    tblCustomers (Fields: ID, CustomerName, PreviousIncrement, CurrentIncrement)
    tblIncrements (Fields: ID, IncrementName)

    I have redacted some other fields for sake of simplicity.

    PreviousIncrement and CurrentIncrement are both linked to tblIncrements.ID.

    How do I run a query to SELECT the CustomerName, PreviousIncrement's Name, and CurrentIncrement's Name???

    Thank you

  2. #2
    R_Badger is offline Knows a few tricks
    Windows XP Access 2003
    Join Date
    Feb 2012
    Location
    Suffolk, UK
    Posts
    262
    I do it using an alias (see here for me)

    I would try something like:

    SELECT CustomerName, PreviousIncrement as PI,CurrentIncrement as CI FROM (tblCustomers as tc INNER JOIN tblincrements as ti1 ON tc.pI=ti1.incrementname) INNER JOIN tblincrements as ti2 ON tc.ci=ti2.incrementname;

  3. #3
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Just add the tblIncrements table to your query twice, linking each one each field, and returning the IncrementName from each one.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. when (select statement within inner join should be used)?
    By learning_graccess in forum Programming
    Replies: 1
    Last Post: 05-17-2012, 01:54 PM
  2. Update statement with linked table join
    By Guigui in forum Queries
    Replies: 6
    Last Post: 09-17-2010, 04:47 AM
  3. Join queries that do not have matching field
    By Petefured in forum Queries
    Replies: 2
    Last Post: 05-04-2010, 11:19 AM
  4. SQL JOIN statement
    By seen in forum Access
    Replies: 10
    Last Post: 01-15-2010, 05:34 PM
  5. How does Access guess join field in query?
    By bar tomas in forum Database Design
    Replies: 1
    Last Post: 05-27-2009, 05:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums