on 08-27-2010 5:26 PM
Buen Dia
Estoy tratando de hacer una consulta que me muestre las ordenes de venta (OINV )a y la factura(ORDR) que se genero de esa orden de venta.
Algo mas o menos asi.
Num. orden de venta Num factura
0001 1235
0002 1038
he tratado de unirlas mediante la instruccion Join pero no funciona como deberia ya que me manda algo asi
Num. orden de venta Num factura
0001 1235
0002 1235
0003 1235
0004 1235
Alguna idea de como hacer esto
Gracias.
Hola...
Intenta con este query...
SELECT DISTINCT T0.[DocNum] AS 'N° Orden de Venta', T2.[DocNum] AS 'N° Factura de Ventas' FROM ORDR T0 INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OINV T2 ON T1.TrgetEntry = T2.DocEntry
Saludos Cordiales,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Muchisimas Gracias si me sirvio el query.
Salu2
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hola...
Te sugiero que revises a nivel de detalle en la Factura (INV1). Existen campos que identifican el documento referencia (puede ser una entrega o una Orden de Venta e incluso una cotización)
BaseType (Clave de Objeto del documento origen, ejemplo: si es una entrega aparece 15)
BaseRef (Número del documento origen)
Intenta el join entre los campos BaseRef (INV1) y DocNum del documento base (ORDR).
Saludos Cordiales,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Unelas mediante un left join donde la tabla rdr1 que contiene los items, se encuentre en la inv1 de las facturas
necesitas unir asi
from rdr1 a left join inv1 b on a.trgetentry=b.baseentry and a.linenum=b.baseline
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
7 | |
7 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.