Results 1 to 2 of 2
  1. #1
    learning_graccess is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Oct 2011
    Posts
    40

    need two subtotals in ms access

    Hi,

    I have a data similar to this :
    saledate >> item >> qty
    01.10.2011 >>> pen >> 23
    01.10.2011 >>> pencil >> 55
    02.10.2011 >> stick >> 45
    03.10.2011 >> fevistick >> 25
    03.10.2011 >> paper >> 55
    04.10.2011 >> magic paper >> 33
    04.10.2011 >> small paper >> 21

    Now when I put the following code
    Code:
    select saledate, sum(qty)
    from table
    GROUP BY saledate
    UNION ALL
    select 'total' as saledate, sum(qty) 
    from table
    GROUP BY total
    The output is
    saledate >> qty
    01.10.2011 >> 78
    02.10.2011 >> 45
    03.10.2011 >> 80
    04.10.2011 >> 54
    total >> 257

    But I want subtotal at the bottom of 2nd date and 4th date like below : how is it possible?

    saledate >> qty
    01.10.2011 >> 78
    02.10.2011 >> 45


    total >> 123
    03.10.2011 >> 80
    04.10.2011 >> 54
    total >> 134

  2. #2
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    A good way to do this would be to create a Report using your query as the data source.

    In the Report, you can have subtotals - like you want.

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

Similar Threads

  1. More detailed subtotals
    By kcmiuser in forum Queries
    Replies: 0
    Last Post: 06-27-2011, 06:10 AM
  2. Subreport grouping subtotals
    By herolind in forum Reports
    Replies: 1
    Last Post: 06-18-2011, 10:23 AM
  3. supress subtotals code
    By sandyg in forum Reports
    Replies: 1
    Last Post: 02-16-2011, 11:38 PM
  4. Subtotals within a query
    By mulefeathers in forum Queries
    Replies: 2
    Last Post: 06-07-2010, 01:02 PM
  5. suppress subtotals when only 1 record
    By schristy in forum Reports
    Replies: 3
    Last Post: 02-15-2010, 10:00 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