Problema con Consulta SQL

15/03/2007 - 22:58 por Nomad(CR) | Informe spam
Hola

Estoy usando estan consulta para tratar de sumar InvoiceDetail.QTY y
devolver en SumaDeQTY, pero adivine que?

No lo suma, alguna estupidez debo estar haciendo pero la veo.
cualquier ayuda se las agradezco de verdad...

SELECT
InvoiceHeader.season,
InvoiceHeader.N_Invoice,
InvoiceHeader.Type,
InvoiceDetail.PlantName,
Sum(InvoiceDetail.Qty) AS SumaDeQty
FROM InvoiceHeader INNER JOIN InvoiceDetail ON
(InvoiceHeader.N_Invoice = InvoiceDetail.Invoice) AND
(InvoiceHeader.Type = InvoiceDetail.Type)
WHERE (((InvoiceHeader.InvoiceDate) Between @fecha1 And @fecha2 ))
GROUP BY InvoiceDetail.PlantName, InvoiceHeader.season,
InvoiceHeader.N_Invoice, InvoiceHeader.Type;


Saludos

NomadCR

Preguntas similare

Leer las respuestas

#1 Maxi
16/03/2007 - 00:36 | Informe spam
Hola, no se que quiere decir que no sume, pero te hago un comentario, si
tenes valores nulos vas a estar en problemas, yo te recomendaria entonces

SELECT
InvoiceHeader.season,
InvoiceHeader.N_Invoice,
InvoiceHeader.Type,
InvoiceDetail.PlantName,
Sum(isnull(InvoiceDetail.Qty,0)) AS SumaDeQty
FROM InvoiceHeader INNER JOIN InvoiceDetail ON
(InvoiceHeader.N_Invoice = InvoiceDetail.Invoice) AND
(InvoiceHeader.Type = InvoiceDetail.Type)
WHERE (((InvoiceHeader.InvoiceDate) Between @fecha1 And @fecha2 ))
GROUP BY InvoiceDetail.PlantName, InvoiceHeader.season,
InvoiceHeader.N_Invoice, InvoiceHeader.Type;



Saludos

[Microsoft MVP SQL Server]
SQLTOTALConsulting - Servicios y consultoria de SQLServer
www.sqlgurus.org
Buenos Aires - Argentina
http://msmvps.com/blogs/maxiaccotto/
"Nomad(CR)" wrote in message
news:
Hola

Estoy usando estan consulta para tratar de sumar InvoiceDetail.QTY y
devolver en SumaDeQTY, pero adivine que?

No lo suma, alguna estupidez debo estar haciendo pero la veo.
cualquier ayuda se las agradezco de verdad...

SELECT
InvoiceHeader.season,
InvoiceHeader.N_Invoice,
InvoiceHeader.Type,
InvoiceDetail.PlantName,
Sum(InvoiceDetail.Qty) AS SumaDeQty
FROM InvoiceHeader INNER JOIN InvoiceDetail ON
(InvoiceHeader.N_Invoice = InvoiceDetail.Invoice) AND
(InvoiceHeader.Type = InvoiceDetail.Type)
WHERE (((InvoiceHeader.InvoiceDate) Between @fecha1 And @fecha2 ))
GROUP BY InvoiceDetail.PlantName, InvoiceHeader.season,
InvoiceHeader.N_Invoice, InvoiceHeader.Type;


Saludos

NomadCR

email Siga el debate Respuesta Responder a este mensaje
Ads by Google
Help Hacer una preguntaRespuesta Tengo una respuesta
Search Busqueda sugerida