drop view if exists view_all_objects; create view view_all_objects as (select id, 'second' as real_base from second where active='Y') union (select id, 'comm' as real_base from comm where draw='Y') union (select id, 'zem' as real_base from zem where draw='Y') union (select obj_id as id, 'cottage' as real_base from cottage where obj_status=91);