
28/02/2010, 22:31
|
 | | | Fecha de Ingreso: febrero-2010
Mensajes: 13
Antigüedad: 15 años Puntos: 0 | |
Respuesta: Consulta Select Supongo q con esto se resuelve tu problema.....sino es asi entonces explica un poco mas y con gusto te ayudamos
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;
union
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;
union
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; |