I am trying to do a Left Join but when I enter my code I get a syntax error and but I see that my code is not wrong, can someone validate?
My MySQL code
SELECT * FROM 4am_comsysn.ageperso LEFT JOIN (SELECT 4am_traficon.ts_horas.coduser,
COUNT( DISTINCT 4am_traficon.ts_horas.codorden) AS orden,
COUNT( 4am_traficon.ts_horas.corre) AS core,
SUM( 4am_traficon.ts_horas.tothoras) AS horas, 4am_traficon.ts_horas.fecha
FROM 4am_traficon.ts_horas
GROUP BY 4am_traficon.ts_horas.coduser) 4am_traficon.ts_horas ON 4am_comsysn.ageperso.codper = 4am_traficon.ts_horas.coduser;
Attached screenshot of the error
The error is related to the way you placed the alias of the subquery: