MySQL error 1248: Every derived table must have its own alias

422 Views Asked by At

I run into this issue with the query

SELECT 
  GROUP_CONCAT( CONCAT(
  id , '|' , calc_eu , '|' , ( 
        SELECT 
          CASE 
            WHEN texto IS NULL THEN '' 
            ELSE texto 
          END 
        FROM 
          ( 
            SELECT 
              texto_es AS texto
            FROM 
              bdgui_diccionario_unidad 
            WHERE 
              bdgui_diccionario_unidad.id = bdgui_unidad.text_eu_id 
          )
      )
  ) SEPARATOR '|' ) AS unidad 
FROM 
  bdgui_unidad ;

If I add an alias to subquery AS alias I got another error

SELECT 
  GROUP_CONCAT( CONCAT(
  id , '|' , calc_eu , '|' , ( 
        SELECT 
          CASE 
            WHEN texto IS NULL THEN '' 
            ELSE texto 
          END 
        FROM 
          ( 
            SELECT 
              texto_es AS texto
            FROM 
              bdgui_diccionario_unidad 
            WHERE 
              bdgui_diccionario_unidad.id = bdgui_unidad.text_eu_id 
          ) AS alias
      )
  ) SEPARATOR '|' ) AS unidad 
FROM 
  bdgui_unidad ;

Error Code: 1054. Unknown column 'bdgui_unidad.text_eu_id' in 'where clause'

0

There are 0 best solutions below