I import a CSV file that contains both positive and negative numbers into Access as Quantity. I am trying to figure a way to seperate those numbers into 2 columns. But, even more confusing, each row has a barcode and some of those barcode rows duplicate. So, I need to SUM the total of positive and negative numbers based on the barcode. I want to seperate the postive numbers (Items Out) with negative numbers (Items In) to get Items Sold. I thought the following code would be a start for getting those number, but I don't get the correct results. Can anyone help? - Thanks.
<cfquery name="CountBarcodes" datasource='inventory'>
SELECT barcode, sum(quantity) as QuantityPositive
FROM temp
WHERE Quantity > 0
GROUP BY barcode
</cfquery>