select GROUP_CONCAT(distinct anuncio.empresa) anuncios_concorrentes from anuncio inner join ramo_anuncio on anuncio.id = ramo_anuncio.id_anuncio where ramo_anuncio.id_ramo = and ramo_anuncio.id_anuncio <> [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and ramo_anuncio.id_anuncio <>' at line 1]SELECT CONCORRENTES