Advertisement

TrimwebsolutionsTrimwebsolutions

Problem and Solutions

sql. how to select rows based on values of other columns in sql ?

By M.K. Verma · 4 May 2022

sql. how to select rows based on values of other columns in sql ?
select * from mytable a
    where exists (select 'Roll' from mytable b where a.column_1 = b.column_1 and b.column_2 = 'yes')
    and exists (select 'Tide' from mytable c where a.column_1 = c.column_1 and c.column_2 = 'no')