1 2 3 4 5 6 7 8 9 10
| select * from (
SELECT dathis, sum(uvcrec) AS uvcrec, sum(stkuvc) as stkuvc, (SELECT sum(uvcsrv) AS uvcsrv FROM GEHACT where dathis=gehpro1.dathis) as uvcsrv, sum(uvcliv1+uvcliv2+uvcliv3+uvcliv4+uvcliv5) AS uvcliv from gehpro1 where codpro>='M' and codpro<'R'
union
SELECT dathis, sum(uvcrec) AS uvcrec, sum(stkuvc) as stkuvc, (SELECT sum(uvcsrv) AS uvcsrv FROM GEHACT where dathis=gehpro1.dathis) as uvcsrv, sum(uvcliv1+uvcliv2+uvcliv3+uvcliv4+uvcliv5) AS uvcliv from gehpro1 where codpro like 'R07%'
union
SELECT dathis, sum(uvcrec) AS uvcrec, sum(stkuvc) as stkuvc, (SELECT sum(uvcsrv) AS uvcsrv FROM GEHACT where dathis=gehpro1.dathis) as uvcsrv, sum(uvcliv1+uvcliv2+uvcliv3+uvcliv4+uvcliv5) AS uvcliv from gehpro1 where codpro like 'R15%'
union
SELECT dathis, sum(uvcrec) AS uvcrec, sum(stkuvc) as stkuvc, (SELECT sum(uvcsrv) AS uvcsrv FROM GEHACT where dathis=gehpro1.dathis) as uvcsrv, sum(uvcliv1+uvcliv2+uvcliv3+uvcliv4+uvcliv5) AS uvcliv from gehpro1 where codpro>'S4')
group by dathis
order by dathis desc |
Partager