drop view if exists special_offers; create view special_offers as (select id, special_offer, 'second' as real_base, city, street as address, detail, price, price_type, realty_id from second where special_offer>0) union (select id, special_offer, 'comm' as real_base, city, street as address, detail, price_min as price, price_type, realty_id from comm where special_offer>0) union (select id, special_offer, 'zem' as real_base, city, street as address, detail, price_min as price, price_type, realty_id from zem where special_offer>0) union (select obj_id as id, obj_special_offer as special_offer, 'cottage' as real_base, obj_city as city, obj_address as address, obj_detail as detail, obj_price_min as price, obj_price_type as price_type, obj_realty_id from obj_draft_cottage where obj_special_offer>0);