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

  • Home
  • SEARCH
  • 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 3237124
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:42:07+00:00 2026-05-17T17:42:07+00:00

hEY ALL i have a table that shows transactions and their status. How can

  • 0

hEY ALL

i have a table that shows transactions and their status. How can i create a column that shows the total of transactions that are completed,rejected,declined and the grand total of all on a different column

for example i am looking something like this

Completed 100
Rejected 50
Declined 20
Total        170

In 3 different rows..

The table fields are something like this.

transaction_id
status_id,
date
transaction_number
  • 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-17T17:42:08+00:00Added an answer on May 17, 2026 at 5:42 pm

    Assuming the textual status you mention in your desired output corresponds to the status_id column in your table, you could use something like:

    SELECT status_id, count(*)
    FROM dbo.YourTable
    GROUP BY status_id WITH ROLLUP
    

    This works for SQL Server 2000 and newer – not sure if other RDBMS have the exact same syntax… (unfortunately, you didn’t mention what system you’re using…)

    The WITH ROLLUP will cause an extra line to be added to your result with a status_id of NULL – this is the total of all counts combined.

    You didn’t mention how to “translate” the status_id into a textual description – that could be added if you provide the necessary info….

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

Sidebar

Related Questions

hey all. I have a table in my DB that has about a thousand
Hey all, I'm about to rip my hair out. I have this client that
Hey, I have a tables called downloads, and in that table it stores the
Hey all, quick NHibernate question. In my current project, we have a denormalized table
I am trying to create several models that all pull from the same table.
Hey. i am writing a forum, and i have this table that marks messages
Hey all. I have a project that will require user input of anywhere from
Hey all, I have a basic HTML contact form that goes to a .php
Hey at the moment we have an arrray selecting all from one table (relationship)
Hey all I'm trying to get a window populated with a table view that

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.