getItemIdByAlias:bike-and-run-des-olonnes-bike-run-s
SELECT evt.`id_organizer` as id_organizer,evt.website_url,evt.logo,evt.canonical_url event_canonical_url,fft.name_event as event_name,evt.name as event_name2,fft.name_trial as trial_name,year(trial.start_date) start_year,month(trial.start_date) start_month,day(trial.start_date) start_day,(CASE WHEN DATE_FORMAT(trial.start_date,"%Y%m%d") `locality`,ef.`lib_discipline`,ef.`lib_distance`,ef.`lib_format`
FROM #__t2area_trials as trial
LEFT JOIN #__t2area_event_format AS ef ON ef.slug = concat(trial.t2area_discipline, (CASE WHEN trial.t2area_distance IS not NULL AND trial.t2area_distance != "" THEN concat("-", trial.t2area_distance) ELSE "" END),(CASE WHEN trial.t2area_format IS not NULL AND trial.t2area_format != "" THEN concat("-", trial.t2area_format) ELSE "" END))
INNER JOIN #__t2area_events as evt on evt.id = trial.id_event
LEFT JOIN #__t2area_trials_fftri as fft on fft.id_trial = trial.fftri_id_trial
INNER JOIN #__t2area_places as pl on pl.id = evt.id_place
INNER JOIN #__t2area_departments AS de ON de.id = pl.id_department
INNER JOIN #__t2area_countries AS co ON co.id = pl.id_country
INNER JOIN #__t2area_leagues AS le ON le.id = de.id_league
INNER JOIN #__t2area_federations AS fe ON fe.id = le.id_federation
WHERE trial.id = '124935'