Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 642301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:09:22+00:00 2026-05-13T21:09:22+00:00

I am trying to create a report that has a summary for each group.

  • 0

I am trying to create a report that has a summary for each group. For example:

ID           NAME              COUNT           TOTAL     TYPE
-------------------------------------------------------------
1            Test 1            10                         A
2            Test 2            8                          A
                                               18

7            Mr. Test          9                          B
12           XYZ               4                          B
                                               13

25           ABC               3                          C
26           DEF               5                          C
19           GHIJK             1                          C
                                               9

I have a query that can do everything except the TOTAL columns:

       select sd.id DATA_REF_NUM ID, count(sd.DATA_DEF_ID) COUNT, defs.data_name NAME, sd.type
       from some_data sd, data_defs defs
       where sd.data_def_id = defs.data_def_id
       group by some_data.type, some_data.id, defs.data_nam
       order by some_data.id asc, count(amv.MSG_ID) desc ;

I’m just not sure how to get a summary on a group. In this case, I’m trying to get a sum of COUNT for each group of ID.

UPDATE:

Groups are by type. Forgot that in the original post.

TOTAL is SUM(COUNT) for each group.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T21:09:23+00:00Added an answer on May 13, 2026 at 9:09 pm

    How about using ROLLUP like…

    select sd.id DATA_REF_NUM ID, count(sd.DATA_DEF_ID) COUNT, defs.data_name NAME, sd.type
    from some_data sd, data_defs defs
    where sd.data_def_id = defs.data_def_id
    group by ROLLUP(some_data.type, (some_data.id, defs.data_nam))
    order by some_data.id asc, count(amv.MSG_ID) desc ;

    This works for a similar example in my database, but I only did it over two columns, not sure how it will function over more…
    Hope this is helpful,
    Craig…

    EDIT: In a ROLLUP, columns you want to sum over but not subtotal over like id and data_nam should be lumped together inside the ROLLUP in parantheses)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a simple report on an intranet site. Based on this
I am trying to create a table with two groups in a BIRT report.
I'm trying to make sure that I don't leave any loose ends open in
Once again the SSRS security wall has hit me. I did a fresh SSRS
I am trying to display different images based on data returned. I am running
I have a very basic question with the Microsoft CRM 4.0 Report wizard. I
I am using the Nov version of the AjaxControlToolkit, and I found a logic
I'm setting up a problem tracking system for a client and I'd like to
I have a bar chart with horizontal bars. I used this article to setup
Does anyone else get this problem or know a solution / workaround I could

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.