select id,'A' as type from tableAunion allselect id,'B' as type from tableB
create view abas select id,'A' type from aunion allselect id,'B' type from b
select id,type='A' from tableAunion allselect id,type='B' from tableB