I have a query in which I am trying to multiply a group of records in one specific field, just like you would do when you do a Sum.
So, instead of having a query take a column of data and adding them together, I want to mulitply them:
SUM: 2+5+4=11
Mult: 2*5*4=40
Is there another way to do this? One that will work with a negative number, that is.
Because, I have a query that I am trying to "fix". I did not write the query nor did I write the 6 that come after it, that are used to arrave at the final record set, so I am not the creator of the logic behind it all.
What I do know is that if I have a negative number it breaks. What is currently in place is:
MultQty: Exp(Sum(Log([ShpBrkdwnQty])))
Which does work (althought I don't know why the math works!) but when the data in ShpBrkdwnQty contains a negative number it dies with an "illegal procedure", because the Log function only works on positive numbers.
So I am open for suggetions.
The entire query is as follows:
So, instead of having a query take a column of data and adding them together, I want to mulitply them:
SUM: 2+5+4=11
Mult: 2*5*4=40
Is there another way to do this? One that will work with a negative number, that is.
Because, I have a query that I am trying to "fix". I did not write the query nor did I write the 6 that come after it, that are used to arrave at the final record set, so I am not the creator of the logic behind it all.
What I do know is that if I have a negative number it breaks. What is currently in place is:
MultQty: Exp(Sum(Log([ShpBrkdwnQty])))
Which does work (althought I don't know why the math works!) but when the data in ShpBrkdwnQty contains a negative number it dies with an "illegal procedure", because the Log function only works on positive numbers.
So I am open for suggetions.
The entire query is as follows:
Code:
SELECT [T-SetupSheetHistoryShipments-Brkdwn].ShpmntID, [T-SetupSheetHistoryShipments-Brkdwn].LineUnitNum, [T-SetupSheetHistoryShipments-Brkdwn].PkGrp, [T-SetupSheetHistoryShipments-Brkdwn].PkInd, Exp(Sum(Log([ShpBrkdwnQty]))) AS MultQty, Min([T-SetupSheetHistoryShipments-Brkdwn].ShpBrkdwnItem) AS ShpItem, Min([T-SetupSheetHistoryShipments-Brkdwn].ShpBrkdwnWOID) AS ShpWOID, Min([T-SetupSheetHistoryShipments-Brkdwn].ShpBrkdwnWOIDShipper) AS ShpWOIDShipper
FROM [T-SetupSheetHistoryShipments-Brkdwn]
GROUP BY [T-SetupSheetHistoryShipments-Brkdwn].ShpmntID, [T-SetupSheetHistoryShipments-Brkdwn].LineUnitNum, [T-SetupSheetHistoryShipments-Brkdwn].PkGrp, [T-SetupSheetHistoryShipments-Brkdwn].PkInd
HAVING ((([T-SetupSheetHistoryShipments-Brkdwn].ShpmntID)=4530));