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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:11:01+00:00 2026-05-26T09:11:01+00:00

I work for a school system as a data guy, and in my latest

  • 0

I work for a school system as a data guy, and in my latest report that I need to send to the state I need to send some data about students taking tests. Easy enough.

The problem arises from this fact: when teachers or administrators entered data concerning students with multiple special needs they sometimes filled it out right, which is by saying multiple disabilities, and sometimes they made individual entries for each special need. For instance a student might have a learning disability and an emotional disability and the admin would make two entries, rather than one.

My query, which is long so I won’t bother with the whole thing, needs something like this:

select 

  stuff
  ,morestuff
  ,CASE
      When [**a student is in the list multiple times**]
           Then '**Multiple Disabilities**'
      When '01' 
           Then 'Blind'

and so forth.

In my head it seems easy, but when I try and commit it to code it falls apart.

  • 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-26T09:11:01+00:00Added an answer on May 26, 2026 at 9:11 am

    This should be pretty generic to any RDBMS. This assumes there’s a column called ‘disabilityname’ which would have held your value 01, and assumes there’s a studentid column of some sort.

    If a student appears multiple times in the subquery COUNT(*), it will return Multiple Disabilities, and otherwise return the disabilityname column assuming it has a single value.

    SELECT
      stuff,
      morestuff,
      CASE
        WHEN cnt.numdisabilities > 1 THEN 'Multiple Disabilities'
        ELSE disabilityname
      END as disabilityname
    FROM
      tbl JOIN (
        SELECT studentid, COUNT(*) AS numdisabilities FROM tbl GROUP BY studentid
      ) cnt ON tbl.studentid = cnt.studentid
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently developing a database system for a school that will work with
We have a system that allows our parents (I work for a school district)
I am doing work for school, I'm supposed to write a function that accepts
I have a old school c program that now and then need to tell
My DBA just lost some development work that he did on our development database.
For my school work, I do a lot of switching computers (from labs to
This problem may seem like school work, but it isn't. At best it is
In my work experience, most fresh out of school programmers are set right to
At work we are being asked to create XML files to pass data to
I've already read some articles about this matter, but I'd like to ask once

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.