Results 1 to 2 of 2

Thread: Subtotals

  1. #1
    Join Date
    Feb 2003
    Location
    Winston-Salem,NC
    Posts
    34

    Question Unanswered: Subtotals

    Is there a way to do subtotals in a query? Like if I am doing a query that is based on every hour of a day and want it to display a subtotal after each hour, is this possible?

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    i don't know if later versions after access 97 have the similar capabilities as sql server (WITH ROLLUP)

    however, you can always fake it with a UNION

    select hour(datetimefield), 0, datetimefield, datacolumn
    from yourtable where some conditions
    union all
    select hour(datetimefield), 1, null, sum(datacolumn)
    from yourtable where the same conditions
    group by hour(datetimefield)
    order by 1, 2, 3


    rudy
    http://r937.com/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •