Checking answers combination is correct

  • Hi,

    I am trying to process results to this question:

    "What optional subjects do you study?"

    Results could be one or many of these options:

    1 Option1

    2 Option2

    8 None

    9 NotKnown

    I would like to check if results for each student are valid or not by checking these rules:

    If duplicate codes then invalid result

    if 8 & another code then invalid result

    if 9 & another code then invalid result

     

    [Options table]

    1 Option1

    2 Option2

    8 None

    9 NotKnown

    [Answers table]

    Student Answer

    100 1

    100 2

    101 1

    101 9

    Student 100 answers are valid.

    Student 101 answers are not valid because they break rule number3

    (I understand that table structures need to be improved)

    Which is the best way to implement these 3 rules ?

    I want to do this:

    ValidateStudentAnswers(100) => result : valid

    ValidateStudentAnswers(101) => result : not valid

    TIA

  • This looks like a duplicate of https://www.sqlservercentral.com/forums/topic/validate-result


Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply