SELECT distinct @a:=(if( (h.dateDebPeriode < h.dateFinPeriode and h.dateFinPeriode < DATE_SUB(dateReelle,INTERVAL 1
HOUR))or(h.dateDebPeriode>DATE_SUB(dateReelle,INTERVAL 1 HOUR)),h.GMT_hivers/100,h.GMT_ete/100)) as dc1,
@b:=(if( (h2.dateDebPeriode
DATE_SUB(dateReelle,INTERVAL 1 HOUR)),h2.GMT_hivers/100,h2.GMT_ete/100)) as dc2,
@c:=DATE_ADD(DATE_ADD(DATE_ADD(date_diffusion,INTERVAL if(heure_debutGMT<4,1,0) DAY), INTERVAL heure_debutGMT HOUR), INTERVAL minute_debutGMT MINUTE) as hP,
DATE_ADD(DATE_SUB(@c,INTERVAL @b HOUR),INTERVAL @a HOUR) as hLoc FROM diffusion, onlinefiche as emissionFR, horaires h, zone z, horaires h2, zone z2
left join pays pays2 on z2.idPays=pays2.id inner join villes villes2 on villes2.idPays=pays2.id and villes2.idZone=z2.id
LEFT JOIN onlinefiche as generiqueFR ON emissionFR.id_generique=generiqueFR.id_FR and generiqueFR.id_version=1 WHERE generiqueFR.titre LIKE '%acoustic%' AND diffusion.id_fiche = emissionFR.id AND
z.idHoraire=h.id and z.id=73 and
villes2.id=474 and z2.idHoraire=h2.id and
diffusion.id_signal=2 and emissionFR.id_version=1
AND dateReelle BETWEEN '2008-05-12 02:00:00' AND '2008-05-19 01:59:59'
ORDER BY diffusion.dateReelle LIMIT 0,1 Unknown column 'emissionFR.id_generique' in 'on clause'