SELECT DISTINCT
`t1`.`ID` AS `ID`,
`t1`.`price` AS `price`,
`t1`.`title` AS `title`,
`t1`.`category_id` AS `category_id`,
`t1`.`date` AS `date`,
`t1`.`type` AS `type`,
`t1`.`country_id` AS `country_id`
FROM `ozago_ads` `t1`
INNER JOIN `ozago_ads_meta` `t2` ON `t2`.`id_ad` = `t1`.`ID` AND `t2`.`meta_key` IN (44, 370, 51, 46, 49, 50)
WHERE `type` = '1' AND `region_id` = '4891' AND `category_id` IN ('198') AND `price` > '40000' AND `price` < '200000';
SELECT * FROM table0
LEFT JOIN table1 ON table0.val1 = table1.val1 AND table1.company_id = $company_id
LEFT JOIN table2 ON table0.val2 = table2.vav2 AND table2.company_id = $company_id
LEFT JOIN table3 ON table0.val3 = table3.val3 AND table3.company_id = $company_id
LEFT JOIN table4 ON table0.val4 = table4.val4 AND table4.company_id = $company_id
WHERE
table0.company_id = $company_id
'condition' => 'commentariesToDetail.module = :module',
'on' => 'commentariesToDetail.module = :module',