Relació de tots els lots d’un albarà

select L.DistNumber Lot,LLO1.ItemCode Article,LO1.DocLine Linia,LAL.Quantity QuantitatLinia,LLO1.Quantity QuantitatLot 
from OITL LO1
join ITL1 LLO1 on LLO1.LogEntry=LO1.LogEntry 
join OBTN L on L.SysNumber=LLO1.SysNumber and L.ItemCode=LLO1.ItemCode
join ODLN AL on AL.DocEntry=LO1.DocEntry 
join DLN1 LAL on LAL.DocEntry=LO1.DocEntry and LAL.LineNum=LO1.DocLine
where LO1.DocType=15 and LO1.DocEntry=404218
order by LO1.DocLine