What would be a good way to make this logic work in a SQL query?
select col1, col2, col3, YorN
I want to return YorN as either a literal 'Y' or 'N' based on whether or not something EXISTS or not.
if EXISTS (select 1 from tab2 where tab1.col1 = tab2.col1) then Y
if NOT EXISTS (same as above) then select N
What's the most efficient way of doing this?