- 01
 - 02
 - 03
 - 04
 - 05
 - 06
 - 07
 - 08
 - 09
 - 10
 - 11
 - 12
 - 13
 - 14
 - 15
 - 16
 - 17
 - 18
 - 19
 - 20
 - 21
 - 22
 - 23
 - 24
 - 25
 - 26
 - 27
 - 28
 - 29
 - 30
 - 31
 - 32
 - 33
 - 34
 - 35
 - 36
 - 37
 - 38
 - 39
 - 40
 - 41
 
                        $select = $db->select()
->from('advertisement AS a', $columns)
->joinLeft('resid_apt_secondary AS ras', 'ras.resid_apartment_residental_advertisement_id=a.id', array())
->joinLeft('resid_apt_newly_unready AS ranu', 'ranu.resid_apartment_residental_advertisement_id=a.id', array())
->joinLeft('resid_apt_newly_ready AS ranr', 'ranr.resid_apartment_residental_advertisement_id=a.id', array())
->joinLeft('resid_house_house AS rh', 'rh.resid_house_residental_advertisement_id=a.id', array())
->joinLeft('resid_house_cottage AS rc', 'rc.resid_house_residental_advertisement_id=a.id', array())
->joinLeft('resid_house_dacha AS rd', 'rd.resid_house_residental_advertisement_id=a.id', array())
->joinLeft('resid_garage AS rg', 'rg.residental_advertisement_id=a.id', array())
->joinLeft('sec_residental AS sr', 'sr.section_advertisement_id=a.id', array())
->joinLeft('bld_prod_common AS bpc', 'bpc.bld_production_commercial_advertisement_id=a.id', array())
->joinLeft('bld_prod_food AS bpf', 'bpf.bld_production_commercial_advertisement_id=a.id', array())
->joinLeft('bld_prod_restaurant AS bpr', 'bpr.bld_production_commercial_advertisement_id=a.id', array())
->joinLeft('bld_prod_warehouse AS bpw', 'bpw.bld_production_commercial_advertisement_id=a.id', array())
->joinLeft('bld_prod_garage AS bpg', 'bpg.bld_production_commercial_advertisement_id=a.id', array())
->joinLeft('bld_prod_service_station AS bpss', 'bpss.bld_production_commercial_advertisement_id=a.id', array())
->joinLeft('bld_prod_other AS bpo', 'bpo.bld_production_commercial_advertisement_id=a.id', array())
->joinLeft('bld_office_any AS boa', 'boa.bld_office_commercial_advertisement_id=a.id', array())
->joinLeft('bld_office_admin AS boad', 'boad.bld_office_commercial_advertisement_id=a.id', array())
->joinLeft('bld_office_sales AS bos', 'bos.bld_office_commercial_advertisement_id=a.id', array())
->joinLeft('bld_office_kiosk AS bok', 'bok.bld_office_commercial_advertisement_id=a.id', array())
->joinLeft('bld_farm_cowshed AS bfc', 'bfc.bld_farm_commercial_advertisement_id=a.id', array())
->joinLeft('bld_farm_workshop AS bfw', 'bfw.bld_farm_commercial_advertisement_id=a.id', array())
->joinLeft('bld_farm_chicken_house AS bfch', 'bfch.bld_farm_commercial_advertisement_id=a.id', array())
->joinLeft('bld_farm_other AS bfo', 'bfo.bld_farm_commercial_advertisement_id=a.id', array())
->joinLeft('gas_station AS gs', 'gs.commercial_advertisement_id=a.id', array())
->joinLeft('rm_prod_common AS rpc', 'rpc.room_production_commercial_advertisement_id=a.id', array())
->joinLeft('rm_prod_food AS rpf', 'rpf.room_production_commercial_advertisement_id=a.id', array())
->joinLeft('rm_prod_restaurant AS rpr', 'rpr.room_production_commercial_advertisement_id=a.id', array())
->joinLeft('rm_prod_warehouse AS rpw', 'rpw.room_production_commercial_advertisement_id=a.id', array())
->joinLeft('rm_prod_garage AS rpg', 'rpg.room_production_commercial_advertisement_id=a.id', array())
->joinLeft('rm_prod_service_station AS rpss', 'rpss.room_production_commercial_advertisement_id=a.id', array())
->joinLeft('rm_prod_other AS rpo', 'rpo.room_production_commercial_advertisement_id=a.id', array())
->joinLeft('rm_office_any AS roa', 'roa.rm_office_commercial_advertisement_id=a.id', array())
->joinLeft('rm_office_sales AS ros', 'ros.rm_office_commercial_advertisement_id=a.id', array())
->joinLeft('rm_office_off AS roo', 'roo.rm_office_commercial_advertisement_id=a.id', array())
->joinLeft('rm_office_admin AS road', 'road.rm_office_commercial_advertisement_id=a.id', array())
->joinLeft('rm_office_hall_rental AS roh', 'roh.rm_office_commercial_advertisement_id=a.id', array())
->where('is_recycled = ?', 'no')
->where('is_published = ?', 'yes')
->group(array('a.type', 'a.in_archive'));
                                     
        
            Переделываем проект. В старой версии нашел следующие строчки.