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

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -