>SELECT NVL2(table1.field,'Y','N') FROM table2 LEFT JOIN table1 on table2.id = table1.id and table1.field='AB' >