Results 1 to 4 of 4
  1. #1
    varadaradj is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Sep 2018
    Posts
    11

    Writing a query combing 3 tables

    Hi

    Though I'm using Access for last 10 years, I don't know to write complex queries. I can't understand inner join, outer join, left join or right join. Is there any help available with examples?

    Please help me how to write a query required for me in Access 2007.



    Tables

    1. Master (ID, Name, OpeningBalance fields are required in this table)
    2. Collection ((I) Sum of Amount Collected (field only) for a period ex. 01/04/2017 to 31/03/2018, grouped by ID and (II) sum of amount collected (field only) for the period before {01/04/2017} grouped by Member ID
    3. Refunds ((I) Sum of Amount refunded (field only) for a period ex. 01/04/2017 to 31/03/2018, grouped by ID and (II) sum of amount refunded (field only) for the period before {01/04/2017} grouped by Member ID



    I want to query (generation a recordset itself is sufficient to create a report) by combing the above data from 3 tables (viz) ID, Name, OpenBalance field from Table 1, Sum(AmountCollected)-1 and sum(amountCollected)-2 from Table 2 and sum(AmountRefunded) from table 3 by matching respective ID (A unique data).

    Thanks in Advance

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,921
    Use Access query designer. Then switch to SQL View to see the structure. That's how I learned a lot of SQL coding.

    What you want will probably involve multiple queries.

    This is really the same concept of calculating inventory balance. You have transaction records of somethings in and somethings out. Review http://allenbrowne.com/AppInventory.html
    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.

  3. #3
    sugr74 is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2018
    Posts
    24
    OK i got all the jobs now, but i need to set the field which comes up empty to zero, how do i do that please?

    Tia

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,921
    @sugr74, you should start your own thread and better explain what you are trying to accomplish.

    Post sample data and desired output. Post the attempted query.
    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. Combing Tables in Query Ignoring Dates
    By adam1218.ac in forum Queries
    Replies: 2
    Last Post: 10-24-2016, 03:46 PM
  2. Replies: 5
    Last Post: 04-25-2013, 02:38 PM
  3. Combing two tables with missing dates
    By Jerseynjphillypa in forum Queries
    Replies: 1
    Last Post: 07-19-2012, 10:51 AM
  4. Combing two tables together
    By Jerseynjphillypa in forum Queries
    Replies: 7
    Last Post: 06-14-2012, 12:07 PM
  5. Need Help with writing Query for TWO TABLES
    By taimysho0 in forum Programming
    Replies: 4
    Last Post: 01-18-2012, 07:26 PM

Tags for this Thread

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