sql - return condition if item exists -


i have query:

select cola, colb tablea colb in ('cata','catb') , cola in ('value1', 'value2', ..., 'value999')  

right now, query displays record valuex satisfies first condition.

how can modify query show 999 valuex , yes/no column if meets colb in ('cata','catb') requirement?

it sounds want

select cola,         colb,         case when colb in ('cata','catb')              'yes'              else 'no'          end your_column_name   tablea  cola in ('value1', 'value2', ..., 'value999')   order (case cola                 when 'value1' 1                 when 'value2' 2                 ...                 when 'value999' 999             end) 

Comments