Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003
    Posts
    61

    Unanswered: subtotals in a query

    I know it's possible to build a query that calculates totals but then it only shows the total value and not the underlying records. Is it possible to build query that show both? I kow one usually does this in a report but that is not what i want!
    Nobody dies a virgin because life screws us all!

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    select A, B, C
    from yourtable
    union all
    select A, B, sum(C)
    from yourtable
    group by A, B
    union all
    select A, null, sum(C)
    from yourtable
    group by A
    union all
    select null, null, sum(C)
    from yourtable
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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