SELECT
`g`.`id`,
`g`.`parent_id`,
`g`.`original_id`,
`g`.`dir`,
`g`.`way`,
`g`.`title`,
`g`.`title_long`,
`g`.`type`
FROM `market_articles` `a`
INNER JOIN `market_items` `i` ON `i`.`id` = `a`.`id`
INNER JOIN `market_groups` `g` ON `g`.`id` = `a`.`group_id`
WHERE `i`.`hidden` = 0 AND `i`.`deleted` = 0 AND ((`l`.`type` = "atv" AND `l`.`mark_id` = 0) OR (`l`.`mark_id` = "0" AND `l`.`type` = "atv"))
GROUP BY `a`.`group_id`
ORDER BY `g`.`order` ASC, `g`.`title` ASC
Unknown column 'l.type' in 'where clause' Купить новый atv стоимостью от 500 000 рублей на МотоБратан