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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:38:26+00:00 2026-06-04T22:38:26+00:00

At the moment I have this SELECT COUNT (enrollment_id) AS enrollments, COUNT (result) AS

  • 0

At the moment I have this

SELECT
    COUNT (enrollment_id) AS enrollments,
    COUNT (result) AS 
    MAX (result) AS highest_result,
    AVG (result) AS average_result,
    MIN (period_code) AS earliest_enrollment    
FROM 
    enrollment
WHERE
result IS NULL  

What I want to have is the number of enrollments in total, which is what COUNT(enrollment_id) is for. I then want to count the number of NULL values in the results column to obtain a column for unfinalised_enrollments.

Will the WHERE clause at the bottom affect the other SELECT statements that use the results column? If so how do I make it so that I can COUNT just the number of NULL values in the results column and display it in a column called unfinalised_enrollment.

thanks in advance.

  • 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-04T22:38:28+00:00Added an answer on June 4, 2026 at 10:38 pm

    You can use SUM instead of COUNT:

    SELECT
        COUNT (enrollment_id) AS enrollments,
        SUM (CASE WHEN result IS NULL THEN 1 ELSE 0 END) AS null_results,
        MAX (result) AS highest_result,
        AVG (result) AS average_result,
        MIN (period_code) AS earliest_enrollment    
    FROM enrollment    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

At this moment i have this query: select p.idpost, count(c.idpost) from posts p join
At the moment I have the following MySQL query: SELECT COUNT(*) AS `count`, `v`.`value`
I have the following: SELECT q25, COUNT( q25 ) AS count, AVG (q1) AS
At the moment I have this code which fires a projectile: Vector3 d =
I have this script at the moment, which changes an image when a thumbnail
This is what I have at the moment. <h2>Information</h2>\n +<p>(.*)<br />|</p> ^ that is
I have two nested loop in XSL like this, at this moment I use
At the moment when i use this, i have to re-launch the app to
I'm trying to display the result of an MYSQL select count as a hyperlink
Ok This is a good question I think. At the moment I have a

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.