Skip to Content

Ayuda con Query

Hola a todos tengo el siguiente query, que me da la suma de Ganancia de la orden de venta y el de la factura,

Select T5.DocNum AS 'Orden SAP',sum(T4.GPTtlBasPr)'Total Ganancia Orden de Venta', sum(T1.GPTtlBasPr)'Total Ganancia Facturado' From OINV T0 inner join INV1 T1 On T1.DocEntry=T0.DocEntry left join RDR1 T4 on (T1.BaseEntry=T4.DocEntry and T1.BaseType=17 and T1.BaseLine=T4.LineNum) left join ORDR T5 on T5.DocEntry=T4.DocEntryWhere T0.DocDate='07/31/2012' and T1.DocEntry NOT IN (Select BaseEntry FROM RIN1 WHERE BaseType != -1)Group By T5.DocNum

El query anterior me hace lo siguiente

Al ponerlo como T0.Docdate no se de donde salen los 23,487.22

Y si Cambio T0.Docdate (Fecha Factura) por T5.DocDate (Fecha de Orden)

Ya no lo saca, pero necesito que sea a partir de la fecha de Factura.

Que podre estar haciendo mal?

Saludos.

Alessandro.

pastedImage_2.png (62.7 kB)
pastedImage_3.png (54.5 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Aug 01, 2012 at 11:02 PM

    Ya quedo, Faltaba Filtrar la Series.

    Saludos

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.