Swathi Swathi - 5 months ago 16
SQL Question

SQL WHERE IN clause with conditions

This is actual where statement I am trying to edit.. I need only these questions to be searched and displayed(mentioned in the query below).

The first three questions should be displayed only if its answer is 'NO' !

LABEL and DATA are the two columns

WHERE Label IN ('Is the price adequate? ' AND Data='No',
'Were the proper measures taken prior? ' AND Data='No',
'Is the incident reported? ' AND Data='No',
'Did the both prices match?' ,
'Learning Methods',
'Next actions Required','Final feedback')

Answer

It looks like you need something like

WHERE 
    (
        Label IN ('Is the price adequate? ', 
                'Were the proper measures taken prior?   ', 
                'Is the incident reported?  '
             ) 
        AND Data='No'
    )
    or 
    (
        Label IN ('Did the both prices match?' ,
                  'Learning Methods',
                  'Next actions Required',
                  'Final feedback'
                  )
    )