bonjour j'ai réussi à la réaliser avec case when :
select DAYNAME(str_to_date(datevisite, '%d/%m/%y')) as jour,m.designation ,
case DAYNAME(str_to_date(datevisite, '%d/%m/%y')) when 'Monday' then count(*)/(select count(*) from ( SELECT distinct DAYNAME(str_to_date(datevisite, '%d/%m/%y')) as nomjour,
str_to_date(datevisite, '%d/%m/%y')as ladate from identimotif idm,identification idf,motif m where
idf.idclient=idm.idclient and m.idmotif= idm.idmotif and DAYNAME(str_to_date(datevisite, '%d/%m/%y'))='Monday' and
str_to_date(datevisite, '%d/%m/%y %T') between
str_to_date('20/03/12 08:30:00', '%d/%m/%y %T') and str_to_date('06/07/12 16:30:00', '%d/%m/%y %T')) as res
group by nomjour) when 'Friday' then count(*)/(select count(*) from ( SELECT distinct DAYNAME(str_to_date(datevisite, '%d/%m/%y')) as nomjour,
str_to_date(datevisite, '%d/%m/%y')as ladate from identimotif idm,identification idf,motif m where
idf.idclient=idm.idclient and m.idmotif= idm.idmotif and DAYNAME(str_to_date(datevisite, '%d/%m/%y'))='Friday' and
str_to_date(datevisite, '%d/%m/%y %T') between
str_to_date('20/03/12 08:30:00', '%d/%m/%y %T') and str_to_date('06/07/12 16:30:00', '%d/%m/%y %T')) as res
group by nomjour)
when 'Tuesday' then count(*)/(select count(*) from ( SELECT distinct DAYNAME(str_to_date(datevisite, '%d/%m/%y')) as nomjour,
str_to_date(datevisite, '%d/%m/%y')as ladate from identimotif idm,identification idf,motif m where
idf.idclient=idm.idclient and m.idmotif= idm.idmotif and DAYNAME(str_to_date(datevisite, '%d/%m/%y'))='Tuesday' and
str_to_date(datevisite, '%d/%m/%y %T') between
str_to_date('20/03/12 08:30:00', '%d/%m/%y %T') and str_to_date('06/07/12 16:30:00', '%d/%m/%y %T')) as res
group by nomjour) when 'Wednesday' then count(*)/(select count(*) from ( SELECT distinct DAYNAME(str_to_date(datevisite, '%d/%m/%y')) as nomjour,
str_to_date(datevisite, '%d/%m/%y')as ladate from identimotif idm,identification idf,motif m where
idf.idclient=idm.idclient and m.idmotif= idm.idmotif and DAYNAME(str_to_date(datevisite, '%d/%m/%y'))='Wednesday' and
str_to_date(datevisite, '%d/%m/%y %T') between
str_to_date('20/03/12 08:30:00', '%d/%m/%y %T') and str_to_date('06/07/12 16:30:00', '%d/%m/%y %T')) as res
group by nomjour) when 'Thursday' then count(*)/(select count(*) from ( SELECT distinct DAYNAME(str_to_date(datevisite, '%d/%m/%y')) as nomjour,
str_to_date(datevisite, '%d/%m/%y')as ladate from identimotif idm,identification idf,motif m where
idf.idclient=idm.idclient and m.idmotif= idm.idmotif and DAYNAME(str_to_date(datevisite, '%d/%m/%y'))='Thursday' and
str_to_date(datevisite, '%d/%m/%y %T') between
str_to_date('20/03/12 08:30:00', '%d/%m/%y %T') and str_to_date('06/07/12 16:30:00', '%d/%m/%y %T')) as res
group by nomjour) end from identimotif idm,identification idf,motif m where
idf.idclient=idm.idclient and m.idmotif= idm.idmotif and
str_to_date(datevisite, '%d/%m/%y %T') between
str_to_date('20/03/12 08:30:00', '%d/%m/%y %T') and str_to_date('06/07/12 16:30:00', '%d/%m/%y %T')
group by DAYNAME(str_to_date(datevisite, '%d/%m/%y')),m.designation