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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:50:14+00:00 2026-06-09T13:50:14+00:00

By using Sql server 2008 I can return two table results like College Department

  • 0

By using Sql server 2008 I can return two table results like

College    Department   Course    Section   Passed

  X           CS         B.Sc        A        30
  X           CS         B.Sc        B        12

and the second result

College    Department   Course    Section   Failed

  X           CS         B.Sc        A        23
  X           CS         B.Sc        B        42

here, am joining one extra table than the first one, if I use the same query to get both the passed and failed count, the count goes wrong, thats what am using two different queries.

Am trying to combine these two tables, to get the result like

College    Department   Course    Section   Passed   Failed

  X           CS         B.Sc        A        30       23
  X           CS         B.Sc        B        12       42

but I dunno how to do this, can anyone help me out here, thanks in advance.

Note : here am joining about 3 to 5 tables in both the queries.

  • 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-09T13:50:15+00:00Added an answer on June 9, 2026 at 1:50 pm

    Use case Statement

    select College,    Department ,  Course  ,  Section ,
           sum(case when <pass condition> then 1 else 0) as Passed  ,
           sum(case when <fail condition> then 1 else 0) as Failed
    from <table1>
    join <table2>
    on (condition)
    group by College,    Department ,  Course  ,  Section
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can i sync sql server 2008-R2 (remopte server and local) using Microsoft Sync
Using SQL Server 2008, is there a way to allow inserts to a table
I'm using SQL Server 2008. I have a table with x amount of rows.
Ok I'm using SQL Server 2008 and have a table field of type VARCHAR(MAX)
I am using SQL Server 2008. I have a query that pulls two random
Am creating a table with sql server 2008 and using linq to sql. Am
Using the Sql Server 2008 how can you actually find an exact string match
Using SQL Server 2008, I need to select this XML into a Table. I
Using Microsoft SQL Server 2008. I have a table of interest rates. I've manually
I am using SQL Server 2008 . I have a table with the following

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.