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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:11:13+00:00 2026-06-09T18:11:13+00:00

I am trying to write a validation for the following set of data: SSYS

  • 0

I am trying to write a validation for the following set of data:

SSYS | Material_Number | Characteristic | Description
001  | 000000000001111 | SH_DESC        | TEST
001  | 000000000001111 | DESIGN_TYPE    | NULL
001  | 000000000001111 | VOLTAGE        | NULL
001  | 000000000009999 | SH_DESC        | TEST2
001  | 000000000009999 | OPER_METHOD    | LIGHT
001  | 000000000009999 | FILTER_TYPE    | Filter element,Air
001  | 000000000014560 | SH_DESC        | Horn,Signal
001  | 000000000014560 | DIMENSION_SIZE | NULL
001  | 000000000014560 | FILTER_TYPE    | NULL

I would like to group by the Material_Number and count as 1 (ie. true) if within the Material_Number group, the SH_DESC description is NOT NULL and all other characteristics’ descriptions IS NULL. So, in this case my result would be:

SSYS | Material_Number | Characteristic | Description  | COUNT
001  | 000000000001111 | SH_DESC        | TEST         |  1
001  | 000000000009999 | SH_DESC        | TEST2        |  0 
001  | 000000000014560 | SH_DESC        | Horn,Signal  |  1

My attempt:

Select COUNT (*), SSYS, Material_Number, Characteristic, Description
 From myDB where (Characteristic = 'SH_DESC' AND DESCRIPTION IS NOT NULL) AND (Characteristic NOT IN ('SH_DESC') IS NULL)
GROUP BY SSYS, Material_Number, Characteristic, Description HAVING COUNT (*) < 2

Any help is much appreciated!

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

    Try:

    Select SSYS, 
           Material_Number, 
           'SH_DESC' Characteristic, 
           MAX(CASE WHEN Characteristic = 'SH_DESC' THEN Description END) Description,
           CASE WHEN MAX(CASE WHEN Characteristic = 'SH_DESC' THEN Description END) IS NOT NULL AND
                     MAX(CASE WHEN Characteristic <>'SH_DESC' THEN Description END) IS NULL 
                THEN 1
                ELSE 0
           END COUNT
    From myDB
    GROUP BY SSYS, Material_Number
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write validation rules for my data objects in a WPF application
I'm trying to write a user name validation that has the following restrictions: Must
I was trying to write a validation for Rails to ensure that a price
I am trying to write my own form validation script with jQuery. However, I
I m trying write code that after reset set up rrpmax as 3000. It
I am trying write a function that generates simulated data but if the simulated
I'm trying to write my own Custom Validation attribute but I'm having some problems.
I am trying to write code for phone number validation. I need to just
I am trying to write a validation rule in Yii but can't get the
I am trying to write a simple input field validation plugin at the moment

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.