In Oracle how to search with sub conditions on same column

In Oracle how do I find Cars which must have Feature1 and have at lest, one out of Feature2 or Feature3. Sample table and expected result should look like below screenshot. Thanks Kiran


This should work:

select, t1.feature
from yourtable t1
inner join
(  -- inner select returns the cars with the Feature1 and Feature2 or Feature3
  select car, feature
  from yourtable 
  where feature = 'Feature1'
    and exists (select car
                from yourtable 
                where feature in ('Feature2', 'Feature3'))
) t2
  on =
where t1.feature in ('Feature1', 'Feature2', 'Feature3') -- this excludes any other features

see SQL Fiddle with Demo

Need Your Help

Python 3 - Sockets with - detecting loss of connection

python sockets python-3.x tcp

I've got a Python 3 server script which runs a TCP socket server, detecting and responding to incoming data using

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.