sql - Restrict column with multiple values not appear if one condition is also met -


so title might not make sense. here's trying do.

c1      c2          c3  a1      yes         x1 a2      no          x1 a3      maybe       x1 a4      yes         x2 

so have condition c2 <>'no'. in case want result include

c1     c2     c3 a4     yes    x2 

appreciate folks!

use minus list of c3s don't have no c2. , select rows table.

 select * table  c3 in(  select distinct c3 table  minus  select distinct table c2 = 'no' ) 

Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -