AYUDA CON INNERS JOINS
Publicado por ANDRES (15 intervenciones) el 05/01/2007 23:28:24
hola cominidad estoy haciendo una consulta sql, y tiene inner join el cual es para mostrar datos de tres tablas Y MI PREGUNTA ES COMO HAGO PARA INSERTARLE UN GROUP BY SI SE LO INSERTO ME DICE QUE NO TODAS LAS TABLAS TIENEN EL CAMPO QUE ESTA DEFINIDO EN EL GROUP
ESTE ES UN EJEMPLO
select (sum(c.cantidad)* sum(c.valor_unitario-c.valor_unitario*c.porcentaje_descuento/100)) as 'valortotal',c.numero,a.fecha,b.nit,b.nombres,b.concepto_5,b.ciudad,a.valor_total from documentos_ped as a inner join terceros as b on a.nit=b.nit inner join documentos_lin_ped as c on a.numero=c.numero
NECESITO PONERLE UN GROUP BY PARA QUE ME AGRUPA ESA SUMA
SERIA
GROUP BY A.NUMERO
COMO LO HAGO SE PUEDE O QUE ME ACONSEJAN
O NO SE PUEDE PONER UN GROUP BY EN UNA INSTRUCCION CON VARIOS INNER JOIN POR QUE SE PIERDE LA INTEGRIDAD?????
ESTE ES UN EJEMPLO
select (sum(c.cantidad)* sum(c.valor_unitario-c.valor_unitario*c.porcentaje_descuento/100)) as 'valortotal',c.numero,a.fecha,b.nit,b.nombres,b.concepto_5,b.ciudad,a.valor_total from documentos_ped as a inner join terceros as b on a.nit=b.nit inner join documentos_lin_ped as c on a.numero=c.numero
NECESITO PONERLE UN GROUP BY PARA QUE ME AGRUPA ESA SUMA
SERIA
GROUP BY A.NUMERO
COMO LO HAGO SE PUEDE O QUE ME ACONSEJAN
O NO SE PUEDE PONER UN GROUP BY EN UNA INSTRUCCION CON VARIOS INNER JOIN POR QUE SE PIERDE LA INTEGRIDAD?????
Valora esta pregunta


0