SELECT a.*, `okso`.`name`, GROUP_CONCAT(DISTINCT `okso_profiles`.`name` SEPARATOR "; ") AS profiles FROM (SELECT `id`, `okso_id`, `form`, `profs_key`, `free`, `score`, `f_cost` FROM `specs` WHERE `specs`.`vuz_id`=? AND `specs`.`okso_id`="571" AND `specs`.`form`=1 AND SUBSTRING(`okso`.`code`, -3, 1)="4" ) a LEFT JOIN `okso` ON `okso`.`id`=a.`okso_id` LEFT JOIN `spec2prof` ON a.`profs_key`=`spec2prof`.`id` LEFT JOIN `okso_profiles` ON `okso_profiles`.`id`=`spec2prof`.`prof_id` GROUP BY a.id | 2564
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'okso.code' in 'where clause'