Nested or multiple case functions

I am trying to do a nested case when query. My table has ID, code1 and code2 columns.
create table as select ID, code1 case when code1 is not null then 'yes' else (select code2, case when code 2 is not null then 'no' else 'NA' from table) from table