I have the following selection which I need to add the amount when the same item is repeated in the same container and lot.
SELECT
LOTE,FECHA_CADUCIDAD,CANTIDAD,CODIGO_CONTENEDOR,ARTICULO,NUMERO_PEDIDO
FROM XXOSI.XXOSI_OMBULLN_SIS_IN_T
WHERE NUMERO_PEDIDO = 'I-142585778531'
AND ARTICULO = '43758'
AND CODIGO_CONTENEDOR = '4'
ORDER BY FECHA_CADUCIDAD;
If I run this query it brings me the following information:
As you can see I have the same number of articulo
.
the same lote
the same contenedor
the same numero de pedido
What I need is to be able to add the amount and show a single item record with the summed amounts, besides that if the Lot is different the query is opened and the amount is not added, but it shows all the article records in the same container for an order number but with a different batch.
Any help is appreciated.