I have following oracle table
https://docs.google.com/a/hassanjanjua.com/spreadsheets/d/1O6wJbkiMsEDWASrUA2bNd7biH7KCnOkXGWrvH9MHLxg/edit?usp=sharing
I want to get list of "ID" if "tabl1" = Y but tabl2,tabl3, tabl4, to tabl5 should be N
I want to get list of "ID" if "tabl2" = Y but tabl1, tabl3, tabl4, tabl5 should be N
I want to get list of "ID" if "tabl3" = Y but tabl1, tabl2, tabl4, tabl5 should be N
I want to get list of "ID" if "tabl4" = Y but tabl1, tabl2, tabl3, tabl5 should be N
I want to get list of "ID" if "tabl5" = Y but tabl1, tabl2, tabl3, tabl4 should be N
Can you post the expected results from the provided sample data.
or if what you provided is the results, please provide the data that would get you those results.
What you will likely need is a CASE statement:
select case when some_column = 'Y' then 'X' else 'Z' end from some_table;
Maybe 'AND'ing them:
select case when some_column = 'Y' and another_col='N' then 'X' else 'Z' end from some_table;
But until I understand what you actually want, I cannot provide the specific CASE syntax.