select a.art_code as code,art_design as designation,art_unite as unite,art_pack as pack,art_puven as pu,q1,q2,q3,q4,q5,q6,q7,q8,+q1+q2+q3+q4+q5+q6+q7+q8 as qtot from article a ,(select a.art_id,case when art_pack=1 then floor(round(c.stk_qte,3)) else round(c.stk_qte*art_pack,0) end as q1 from stock a, article b,stock c where a.art_id=b.art_id and b.art_id_princ=c.art_id and a.adr_id=461 and c.adr_id=461) t1,(select a.art_id,case when art_pack=1 then floor(round(c.stk_qte,3)) else round(c.stk_qte*art_pack,0) end as q2 from stock a, article b,stock c where a.art_id=b.art_id and b.art_id_princ=c.art_id and a.adr_id=462 and c.adr_id=462) t2,(select a.art_id,case when art_pack=1 then floor(round(c.stk_qte,3)) else round(c.stk_qte*art_pack,0) end as q3 from stock a, article b,stock c where a.art_id=b.art_id and b.art_id_princ=c.art_id and a.adr_id=473 and c.adr_id=473) t3,(select a.art_id,case when art_pack=1 then floor(round(c.stk_qte,3)) else round(c.stk_qte*art_pack,0) end as q4 from stock a, article b,stock c where a.art_id=b.art_id and b.art_id_princ=c.art_id and a.adr_id=5455 and c.adr_id=5455) t4,(select a.art_id,case when art_pack=1 then floor(round(c.stk_qte,3)) else round(c.stk_qte*art_pack,0) end as q5 from stock a, article b,stock c where a.art_id=b.art_id and b.art_id_princ=c.art_id and a.adr_id=5731 and c.adr_id=5731) t5,(select a.art_id,case when art_pack=1 then floor(round(c.stk_qte,3)) else round(c.stk_qte*art_pack,0) end as q6 from stock a, article b,stock c where a.art_id=b.art_id and b.art_id_princ=c.art_id and a.adr_id=5732 and c.adr_id=5732) t6,(select a.art_id,case when art_pack=1 then floor(round(c.stk_qte,3)) else round(c.stk_qte*art_pack,0) end as q7 from stock a, article b,stock c where a.art_id=b.art_id and b.art_id_princ=c.art_id and a.adr_id=5733 and c.adr_id=5733) t7,(select a.art_id,case when art_pack=1 then floor(round(c.stk_qte,3)) else round(c.stk_qte*art_pack,0) end as q8 from stock a, article b,stock c where a.art_id=b.art_id and b.art_id_princ=c.art_id and a.adr_id=5734 and c.adr_id=5734) t8 where a.art_id=t1.art_id and a.art_id=t2.art_id and a.art_id=t3.art_id and a.art_id=t4.art_id and a.art_id=t5.art_id and a.art_id=t6.art_id and a.art_id=t7.art_id and a.art_id=t8.art_id and actif
Partager