drop view if exists view_cottage_from_zem; create view view_cottage_from_zem as select id as obj_id, 0 as obj_rev, 0 as obj_base, seller_id as obj_owner, if (draw='Y',91,92) as obj_status, date as obj_date, checked_date as obj_checked_date, '' as obj_xls_md5, 0 as obj_source_id, 0 as _id, village_id as obj_village, 403 as obj_type, city as obj_city, district as obj_district, direction as obj_direction, distance as obj_section_a, 0 as obj_section_b, street as obj_address, add_address as obj_add_address, 0 as obj_floor_house, 0 as obj_square_house, square_min as obj_square_area, 0 as obj_material, price_min as obj_price_min, price_max as obj_price_max, price_type as obj_price_type, '' as obj_price_detail, 0 as obj_water, 0 as obj_sewage, 0 as obj_heat, 0 as obj_compl, 0 as obj_compl_stage, detail as obj_detail, street_id as obj_street_id, phone_num as obj_phone_num, phone_cont as obj_phone_cont, special_offer as obj_special_offer, square_unit as obj_square_unit from zem where draw='Y' and (nazn & ((1 << 2) | (1 << 4)));