Results 1 to 2 of 2
  1. #1
    deepakg27 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2017
    Posts
    160

    Problem With Group by clause in a Query

    Hi Guys,

    I am working on a Simple Billing data base. I have tblSale, tblSaleDetails & tblProduct. I am making a query with a group by clause where all the bills falling under defined date range are grouped together on the basis of product code & product description, fields of Quantity, amount and tax are being totaled (SUM clause in Group BY) together. Till this query works fine. Product Code & Product Description lies in tblProduct & Fields of Quantity, Amount and Tax in tblSaleDetails. Sale Date resides in tblSale.



    Now I want to Add GrandTotal bill amount to the query and sum it up. As long as tblSaleDetail has one record for tblSale query works fine, but as soon as the number of records in tblSaleDetails increase from 1 (let's say for example 3 records of tblSaleDetails for 1tblSale), the GrandTotal is also gets added thrice. How Can I make the query to add the grand total only once for every BillNumber in date Range.

    HOPE I HAVE BEEN ABLE TO EXPLAIN MY PROBLEM.

    Awaiting your help and guidance.
    Thanks and Regards
    Deepak Gupta

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,820
    Consider building a report instead. Use its Sorting & Grouping features with aggregate calcs.
    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. How To Do A Rank Query With a Group By Clause
    By gameemaster in forum Queries
    Replies: 3
    Last Post: 05-23-2017, 05:54 AM
  2. SELECT & GROUP BY Clause
    By johnseito in forum Access
    Replies: 5
    Last Post: 07-11-2014, 10:55 PM
  3. Replies: 6
    Last Post: 07-24-2012, 03:02 PM
  4. Problem With WHERE Clause
    By zephaneas in forum Queries
    Replies: 1
    Last Post: 08-17-2011, 01:54 PM
  5. Problem Adding WHERE Clause
    By zephaneas in forum Queries
    Replies: 1
    Last Post: 08-14-2011, 11:26 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