supportsvc
Technical User
Hello,
I'm trying to figure out how to limit the number of records based on the quantity field
My attempt:
Goal trying to import the number of records based on the quantity shown in the QuantityShipped field of the serial numbers starting with the number user inputs
Example:
QuantityShipped for the Invoice is 500 on the Item from the dbo_SO_InvoiceDetail
Need to import 500 serial numbers from the dbo_IM_ItemCost table starting with the serial number the user wants to start the range from but limit to the reocrds based on the quantity in the QuantityShipped field
Hope this makes sense
I'm trying to figure out how to limit the number of records based on the quantity field
My attempt:
Code:
INSERT INTO dbo_SO_InvoiceTierDistribution ( InvoiceNo, LineKey, LotSerialNo, TierType, ItemCode, WarehouseCode, QuantityShipped )
SELECT dbo_SO_InvoiceDetail.InvoiceNo, dbo_SO_InvoiceDetail.LineKey, dbo_IM_ItemCost.LotSerialNo, dbo_IM_ItemCost.TierType, dbo_IM_ItemCost.ItemCode, dbo_IM_ItemCost.WarehouseCode, dbo_IM_ItemCost.QuantityOnHand
FROM dbo_SO_InvoiceDetail INNER JOIN dbo_IM_ItemCost ON (dbo_SO_InvoiceDetail.WarehouseCode = dbo_IM_ItemCost.WarehouseCode) AND (dbo_SO_InvoiceDetail.ItemCode = dbo_IM_ItemCost.ItemCode)
WHERE (((dbo_IM_ItemCost.QuantityOnHand)=1))
GROUP BY dbo_SO_InvoiceDetail.InvoiceNo, dbo_SO_InvoiceDetail.LineKey, dbo_IM_ItemCost.LotSerialNo, dbo_IM_ItemCost.TierType, dbo_IM_ItemCost.ItemCode, dbo_IM_ItemCost.WarehouseCode, dbo_IM_ItemCost.QuantityOnHand
HAVING (((dbo_SO_InvoiceDetail.InvoiceNo)="S009904") AND ((dbo_IM_ItemCost.LotSerialNo)>=[From SerialNo]) AND ((Count(dbo_IM_ItemCost.QuantityOnHand))=[QtyShipped]));
Goal trying to import the number of records based on the quantity shown in the QuantityShipped field of the serial numbers starting with the number user inputs
Example:
QuantityShipped for the Invoice is 500 on the Item from the dbo_SO_InvoiceDetail
Need to import 500 serial numbers from the dbo_IM_ItemCost table starting with the serial number the user wants to start the range from but limit to the reocrds based on the quantity in the QuantityShipped field
Hope this makes sense