sql - Reject a row based on 2 column values -
below output of simple join query. 3 columns different tables.
col1 col2 col3 manual y-yes include mc y-yes include manual y-yes exclude manual y-yes exclude
i need rows 'include' if there no 'exclude' same col1 value.
if there no 'exclude' col1 value, fine display 'include'.
so query should not display first row according requirement since col1 value 'manual' has 'exclude'.
your sql query should lot question in english: want rows there no row same col1
value has 'exclude' in col3
value, right? cannot give exact sql since not provide table or column names, if 3 columns in same table, this:
select * mytable not exists (select * mytable col1 = t.col1 , col3 = 'exclude')
Comments
Post a Comment