'22:00:00' then '22:00:00' else fin end)-(CASE when debut < '07:00:00' then '07:00:00' else debut end)) as jour, sum((CASE when fin < '22:00:00' then '22:00:00' else fin end)-'22:00:00') + sum('07:00:00'-(CASE when debut > '07:00:00' then '07:00:00' else debut end)) as nuit from ".DB_PREFIXE."candidature inner join ".DB_PREFIXE."agent on candidature.agent=agent.agent where (scrutin = '[Tour_1]' or scrutin = '[Tour_2]') and decision is true group by candidature.agent, agent.nom, agent.prenom order by agent.nom"; $reqmo['Tour_1']="select scrutin, scrutin from ".DB_PREFIXE."scrutin where solde is not true"; $reqmo['Tour_2']="select scrutin, scrutin from ".DB_PREFIXE."scrutin where solde is not true"; // sum((CASE when fin > '22:00:00' then '22:00:00' else fin end)-debut) as jour, // sum((CASE when fin < '22:00:00' then '22:00:00' else fin end)-'22:00:00') as nuit ?>