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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:26:13+00:00 2026-06-08T16:26:13+00:00

I currently have a table that looks like the following: [BUSINESS_PROCESS_ID] [Error Type 1]

  • 0

I currently have a table that looks like the following:

[BUSINESS_PROCESS_ID]   [Error Type 1]    [Error Type 2]     [Error Type 3]
     PVT02                  108                                  93
     PVT02                   98   
     PVT02                   80              80                  80
     PVT02                   80              
     PVT02                   93   
     PVT02                   27              80
     PVT03                   21   
     PVT03                   102  
     PVT03                   80   
     PVT03                   80                                  102
     PVT03                   80   
     PVT03                   80   
     PVT03                   71

Based on each Business_Process_Id, i’m looking to write a query that counts each unique error type. Ie. the query output should look like the following:

[BUSINESS_PROCESS_ID]    [Error Type]  [Count of Unique Error Types Combined]
     PVT02                  108                     1
     PVT02                   98                     1
     PVT02                   80                     5
     PVT02                   93                     2
     PVT02                   27                     1
     PVT02                   98                     1
     PVT03                   21                     1
     PVT03                   102                    2
     PVT03                   80                     4
     PVT03                   71                     1

As you can see, I’m not concerned with whether or not the count is by Error Type 1, 2 or 3. I’m looking to get the count of UNIQUE Error Types (ie. 98,80,108 etc.) by Business_Process_ID.

Could someone help? Thank You.

  • 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-06-08T16:26:15+00:00Added an answer on June 8, 2026 at 4:26 pm

    One way to accomplish this would be to use a UNION query to first put all error types into a single column. Then, you can use a simple query to aggregate the results into how you wish to see them.

    SELECT BUSINESS_PROCESS_ID, [Error Type 1] as ErrorType
    FROM TableName
    UNION ALL
    SELECT BUSINESS_PROCESS_ID, [Error Type 2] as ErrorType
    FROM TableName
    UNION ALL
    SELECT BUSINESS_PROCESS_ID, [Error Type 3] as ErrorType
    FROM TableName
    

    Save this as a query.

    Then, use this query in a aggregation query similar to the following:

    SELECT BUSINESS_PROCESS_ID, ErrorType, Count(ErrorType) as Number_Of_Errors
    FROM MyUnionQuery
    GROUP BY BUSINESS_PROCESS_ID, ErrorType
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a table structure that looks something like this(some details omitted): ColumnName
I have data in a table that looks like the following sample data: varchar(20)
I have a table relationship that looks like the following: barn ------ PK barn_id
So currently I have a table in Lua that contains another table (much like
I have 2 database tables that looks like this Subscriptions table member_id active 5
I have a table in MySQL that looks like this: studentID subjectID anotherID anotherID2
I have a table that looks like this: Id (PK, int, not null) ReviewedBy
I have data frame that looks like the following models cores time 1 4
I have the following data frame (info) that looks like this: > info[1:5,] field
Okay I have a table that looks as following: id | status(bool) | devicename(text)

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.