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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:13:43+00:00 2026-05-26T18:13:43+00:00

Under the my query.I select this way all job count by fullname. SELECT COUNT(sy.FullName)

  • 0

Under the my query.I select this way all job count by fullname.

SELECT COUNT(sy.FullName)                        [Count Job],
       sy.FullName                               [FullName],
       MIN(CAST(i.vrp_notificationdate AS DATE)) [Oldest Date]
FROM   BusinessUnit AS b
       INNER JOIN SystemUser AS sy
         ON b.BusinessUnitId = sy.BusinessUnitId
       INNER JOIN Incident AS i
         ON i.OwnerId = sy.SystemUserId
GROUP  BY f.sy.FullName 

This query show this table

---------------------------------
Count Job   FullName  Oldest Date
  10           a       2011-10-11
  20           B       2011-10-11
  55           C       2011-10-11
---------------------------------

But i want to make under table for example.

--------------------------------------------------------------
Count Job   FullName  Oldest Date      Open Job         Close Job
  10           A       2011-10-11         5                5  
  20           B       2011-10-11         13               7 
  55           C       2011-10-11         48               7
------------------------------------------------------------

I have status of columnname on my Incident Table,if status code is 5 that the job is closed.when i used group by condition statuscode,then table is under .And i dont want show this showing table.

---------------------------------
Count Job   FullName  Oldest Date
  10           a       2011-10-11
  13           B       2011-10-11
  48           C       2011-10-11
  7            B       2011-10-11
  7            C       2011-10-11
---------------------------------

when i use union on my t-sql,i take this error “all queries combined using a UNION, INTERSECT or EXCEPT operator must have an equal number of expressions in their target lists.”

how to exactly solve this query.Any suggestion.

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-26T18:13:44+00:00Added an answer on May 26, 2026 at 6:13 pm

    How about using CASE and SUM?

    SELECT COUNT(sy.FullName)                        [Count Job],
           sy.FullName                               [FullName],
           MIN(CAST(i.vrp_notificationdate AS DATE)) [Oldest Date],
    
           SUM(CASE i.status 
                 WHEN 5 THEN 1
                 ELSE 0)                             [Open Jobs],
    
           SUM(CASE i.status 
                WHEN 5 THEN 0
                ELSE 1)                              [Closed Jobs]
    
    FROM   BusinessUnit AS b
           INNER JOIN SystemUser AS sy
             ON b.BusinessUnitId = sy.BusinessUnitId
           INNER JOIN Incident AS i
             ON i.OwnerId = sy.SystemUserId
    GROUP  BY f.sy.FullName 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to run a query like this: SELECT lower (A.label) FROM addresses
I have this update query: UPDATE aggregate_usage_input t JOIN (SELECT t2.id FROM aggregate_usage_input t2
I retrieve data from database using this query: SELECT * FROM tickets_departement_groups WHERE group_id
I'm trying to do MySQL fulltext search using the following query: SELECT * FROM
I don't even know if I am doing this query the right way. There
I use the following XPATH Query to list the object under a site. ListObject[@Title='SomeValue']
After running a insert or update query against a SQLServer 2005 database, under what
Under what circumstances would this or would this not be safe? I have a
im triyng to figure out an smart way to solve this problem. In my
I currently have just under a million locations in a mysql database all with

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.