Código SQL:
Ver original
SELECT Llenos.gran AS ID,Granja.nom_gran AS NOMBRE,Llenos.num_plan AS PLANILLA, Lote.id_lot AS LOTE,Llenos.cil_ent AS 'TOTAL CILINDROS', (SELECT SUM(pes_cil)FROM Llenos) AS 'PESO B.RETIRO',(SELECT SUM(pes_cil)FROM Llenos) AS 'PESO NO COSUMIDO',Planilla.num_com_plan AS 'O.COMPRA' FROM Llenos,Planilla,Granja,Lote WHERE id_plan=num_plan AND id_gran=gran; SELECT Entrega.gran AS ID,Granja.nom_gran AS NOMBRE,Entrega.num_plan AS PLANILLA, Lote.id_lot AS LOTE,Entrega.cil_ent AS 'TOTAL CILINDROS', (SELECT SUM(pes_cil)FROM Entrega) AS 'PESO B.RETIRO',(SELECT SUM(pes_cil)FROM Entrega) AS 'PESO NO COSUMIDO',Planilla.num_com_plan AS 'O.COMPRA' FROM Entrega,Planilla,Granja,Lote WHERE id_plan=num_plan AND id_gran=gran; SELECT Vacios.gran AS ID,Granja.nom_gran AS NOMBRE,Vacios.num_plan AS PLANILLA, Lote.id_lot AS LOTE,Vacios.cil_vac AS 'TOTAL CILINDROS', (SELECT SUM(pes_cil)FROM Vacios) AS 'PESO B.RETIRO',(SELECT SUM(pes_cil)FROM Vacios) AS 'PESO NO COSUMIDO',Planilla.num_com_plan AS 'O.COMPRA' FROM Vacios,Planilla,Granja,Lote WHERE id_plan=num_plan AND id_gran=gran;