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 6731431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:31:40+00:00 2026-05-26T10:31:40+00:00

I have a table with roughly 7,000,000 records. It’s very flat and for sake

  • 0

I have a table with roughly 7,000,000 records.

It’s very flat and for sake of argument it has 3 columns I wish to aggregate on. This aggregation should very simply create a count /pivot of each instance of that value.

E.G

Company     Status  Year
Hatstand    Open    2011
Hatstand    Closed  2011
Moonbase    Open    2011

Would produce

Count of Hatstand **2**
Count of Hatstand Open **1**
Count of Hatstand Open 2011 **1**

So it’s a very simple count of each “branch” of data.

My first choice was to use a SSRS Matrix control. Which when testing with a small dataset worked really well. However when using a the full data-set would not run.

What is the “correct” way to approach this problem?

Should I pre-aggregate via a stored procedure or SSIS job?
Or should I continue with the SSRS route and try to refine my query?

Thanks

  • 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-26T10:31:41+00:00Added an answer on May 26, 2026 at 10:31 am

    T-SQL is preferred way to go if You are using SQL Server 2005 or 2008.

    If You are using SQL Server 2005 or 2008 You can try:

    SELECT *, COUNT(*) FROM TBL
    GROUP BY COMPANY, STATUS, YEAR
    WITH ROLLUP -- or WITH CUBE
    

    If You are using SQL Server 2008 You can try with :

    SELECT *, COUNT(*) FROM A
    GROUP BY 
    GROUPING SETS (
        (COMPANY),
        (COMPANY, STATUS),
        (COMPANY, STATUS, YEAR)
    )
    

    For details about GROUP BY WITH ROLLUP/CUBE and GROUPING SETS take a look at GROUP BY.

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

Sidebar

Related Questions

I have a user table that has many columns, it looks roughly like this:
We have a (currently InnoDB) table which contains roughly 500,000 rows. This represents a
I have a table called users with roughly 250,000 records in it. I have
So, I have a mysql table that looks roughly like this, where the first
I have this table that has a lot of book related fields including keywords.
I have a table with roughly 100.000 blog postings, linked to a table with
We have a table that looks roughly like this: CREATE TABLE Lockers { UserID
I have two already-existing tables which look (in part) roughly like this: CREATE TABLE
I have a table using innodb. I know the table has roughly 89 million
I have a mysql (5.0.22) myisam table with roughly 300k records in it and

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.