# спец префиксы 'SV', 'BK', 'EVO' нужно собирать со всех языков
SELECT #*
  SA, 
  CONCAT( 
    IF(pref2_E IN ('SV', 'BK') AND (pref2_E != saidx.pref2_L), CONCAT(pref2_E, ' '), ''),
    IF(pref3_E IN ('EVO') AND (pref3_E != saidx.pref3_L), CONCAT(pref3_E, ' '), ''),
    `DESC`) `DESC`,
  CODEONE, CODETWO
FROM
  (SELECT 
    TRIM(SANUM) SA, TRIM(IFNULL(dic_L.`TEXT`, dic_E.`TEXT`)) `DESC`, TRIM(CODEONE) CODEONE, TRIM(CODETWO) CODETWO, /* dic_L.`TEXT`, dic_E.`TEXT`,*/
    SUBSTRING(TRIM(IFNULL(dic_L.`TEXT`, dic_E.`TEXT`)), 1, 2) pref2_L, SUBSTRING(TRIM(dic_E.`TEXT`), 1, 2) pref2_E,
    SUBSTRING(TRIM(IFNULL(dic_L.`TEXT`, dic_E.`TEXT`)), 1, 3) pref3_L, SUBSTRING(TRIM(dic_E.`TEXT`), 1, 3) pref3_E
  FROM alltext_bm_saidx_v saidx
    LEFT OUTER JOIN alltext_sa_dictionary_v dic_L
      ON dic_L.DESCIDX = saidx.DESCIDX
      AND dic_L.LANG = 'Z'
    LEFT OUTER JOIN alltext_sa_dictionary_v dic_E
      ON dic_E.DESCIDX = saidx.DESCIDX
      AND dic_E.LANG = 'E'    
  WHERE
    CATNUM = '22M' AND GROUPNUM = '46' 
  ORDER BY 
    SANUM) saidx
MySQLi_conn::query: Exec query Error: Got error 28 from storage engine