-----------------------------------------------------------------
I've used these but have had issues with them :
SELECT it.[item number] ,
it.[TRX Location] ,
isnull( sum(lt.[SERLTQTY]) , 0 )AS Qty
FROM InventoryTransactions it WITH (NOLOCK)
LEFT OUTER JOIN IV30400 lt WITH (NOLOCK) ON lt.DOCNUMBR = it.[Document Number] and lt.LNSEQNBR = it.[Line SEQ Number]
WHERE [Document Type] <> 'Transfer'
AND it.[item number] BETWEEN @p_cSItemNumber AND @p_cEItemNumber
AND [Document Date] < @p_dEDate
AND (lt.SERLTNUM = @L_cLotNumber or rtrim(@L_cLotNumber) = '')
GROUP BY it.[item number] ,it.[TRX Location]