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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:55:29+00:00 2026-06-04T13:55:29+00:00

I want to sump up two or more counted values [pivoting] My query is

  • 0

I want to sump up two or more counted values [pivoting]
My query is as following:

SELECT 
     client_name.client_name , 
     escort ,
     count(case mission_status_reason when '4' then mission_status_reason end) as awaiting_upload_at_origin,
     count(case mission_status_reason when '6' then mission_status_reason end) as awaiting_military_escort,
     count(case mission_status_reason when '3' then mission_status_reason end) as enrouted_to_destination,
     count(case mission_status_reason when '9' then mission_status_reason end) as awaiting_download,
     ( awaiting_military_escort +enrouted_to_destination+ awaiting_download ) as TOTAL 
FROM usc_tmr 
     LEFT JOIN client_name on client_name.id = usc_tmr.client_name 
WHERE escort='usg' 
  and mission_status_ops IN ('1','4','5','6') 
GROUP BY client_name

My problem is calculating the TOTAL. Can you guys please help.

  • 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-04T13:55:30+00:00Added an answer on June 4, 2026 at 1:55 pm
    SELECT   client_name.client_name,
             escort,
             SUM(mission_status_reason = 4)        AS awaiting_upload_at_origin,
             SUM(mission_status_reason = 6)        AS awaiting_military_escort,
             SUM(mission_status_reason = 3)        AS enrouted_to_destination,
             SUM(mission_status_reason = 9)        AS awaiting_download,
             SUM(mission_status_reason IN (3,6,9)) AS TOTAL
    FROM     usc_tmr LEFT JOIN client_name ON client_name.id = usc_tmr.client_name
    WHERE    escort = 'usg' AND mission_status_ops IN (1,4,5,6)
    GROUP BY client_name
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Want to develop a query refinement tool just like Google Suggest so that i
I have this query: SELECT p.text,se.name,s.sub_name,SUM((p.volume / (SELECT SUM(p.volume) FROM phrase p WHERE p.volume
Want to have vertical scroll bar if content is more than expected in popwindow...
Want make a mind map like the following: Image link is not available anymore.
Want to just confirm on following. Please verify if this is correct: 1. As
Want to populate dynamically combobox-listbox-drop-down using javascript. var table = document.createElement(table); var select =
want to query below xml <courseList filedUnder=Courses> <category code=4wd title=4wd Operation> <product code=lr title=4wd
Want to pass 4 values in AJAX parameter.First three are passing properly but the
Want to change case to lower in whole block in visual mode. If i
I have the following LINQ query: var query = (from p in obj1 group

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.