Results 1 to 2 of 2
  1. #1
    vinsavant is offline Novice
    Windows 8 Access 2013
    Join Date
    Dec 2012
    Posts
    20

    Match Table Fields

    Before
    The following table shows how the Credit transaction (ID 1) has a corresponding offsetting entry in (ID 3).



    ID Cost Center Line of Business Debit Credit Event ID
    1 10056 Retail $5,000 $0.00
    2 10799 Retail $1,450 $0.00
    3 10056 Retail $0.00 $5,000
    4 10022 Commercial $3,000 $0.00


    Every transaction comes into the table as either a Debit or a Credit. Each transaction has a unique ID and it is assigned to a Cost Center and a Line of Business.
    Our goal is to produce a query that will extract transactions that maybe related. In other words, to find a debit amount with an offsetting credit amount in order to assign them an Event ID number in another column. In order to make a match, both transactions (the Credit and the Debit) must have the same Cost Center, belong to the same Line of Business and both the Debit and the Credit amount must be the same value.

    After
    The query results only shows transactions that are related.
    ID Cost Center Line of Business Debit Credit Event ID
    1 10056 Retail $5,000 $0.00
    3 10056 Retail $0.00 $5,000

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    You could try a self-join of the table. The query will not be editable.

    SELECT [Transactions].CostCenter, [Transactions].LineOfBusiness, [Transactions].ID, [Transactions].Debit, Table1_1.ID, Table1_1.Credit
    FROM Transactions AS Table1_1 INNER JOIN Transactions ON (Table1_1.Credit=[Transactions].Debit) AND (Table1_1.LineOfBusiness=[Transactions].LineOfBusiness) AND (Table1_1.CostCenter=[Transactions].CostCenter);
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 16
    Last Post: 03-13-2012, 03:47 PM
  2. Replies: 5
    Last Post: 03-01-2012, 12:59 AM
  3. Replies: 3
    Last Post: 08-05-2011, 08:13 PM
  4. Replies: 1
    Last Post: 11-05-2010, 04:51 AM
  5. Match up table using only a few charecter?
    By bangemd in forum Queries
    Replies: 5
    Last Post: 06-05-2009, 04:15 AM

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