Z
ZigZagZak
Can someone help me with this queries SQL? I have been beating my head on
the desk for hours and can't figure out how to get the CPI: value to work
correctly. Right now it comes back with the first value on the table. I
need it to match the "Bar type" & the "Bar size" with each of the group &
give the CPI. Hopefully that makes sense....I am mentially tired right now.
Thanks
Zach
SELECT
NZ(Sum([LENGTH]*0.2833*(([BarSizeDec]/2)*([BarSizeDec]/2))*3.14159),0) AS
[TOTAL WEIGHT], RECVNEWBAR.[BAR TYPE],
DLookUp("[Costperin]","[BARcost]","[BARCOST]![BARSIZE] ='[BAR SIZE]'" And
"[BARCOST]![BARTYPE] = '[BAR TYPE]'") AS CPI, Sum(RECVNEWBAR.LENGTH) AS
SumOfLENGTH
FROM RECVNEWBAR
WHERE (((RECVNEWBAR.RECVDATE)=#5/1/2009#))
GROUP BY RECVNEWBAR.[BAR TYPE]
HAVING (((RECVNEWBAR.[BAR TYPE])<>"303SS" And (RECVNEWBAR.[BAR
TYPE])<>"304SS" And (RECVNEWBAR.[BAR TYPE])<>"CAST IRON" And (RECVNEWBAR.[BAR
TYPE])<>"YELLOW BAR"));
the desk for hours and can't figure out how to get the CPI: value to work
correctly. Right now it comes back with the first value on the table. I
need it to match the "Bar type" & the "Bar size" with each of the group &
give the CPI. Hopefully that makes sense....I am mentially tired right now.
Thanks
Zach
SELECT
NZ(Sum([LENGTH]*0.2833*(([BarSizeDec]/2)*([BarSizeDec]/2))*3.14159),0) AS
[TOTAL WEIGHT], RECVNEWBAR.[BAR TYPE],
DLookUp("[Costperin]","[BARcost]","[BARCOST]![BARSIZE] ='[BAR SIZE]'" And
"[BARCOST]![BARTYPE] = '[BAR TYPE]'") AS CPI, Sum(RECVNEWBAR.LENGTH) AS
SumOfLENGTH
FROM RECVNEWBAR
WHERE (((RECVNEWBAR.RECVDATE)=#5/1/2009#))
GROUP BY RECVNEWBAR.[BAR TYPE]
HAVING (((RECVNEWBAR.[BAR TYPE])<>"303SS" And (RECVNEWBAR.[BAR
TYPE])<>"304SS" And (RECVNEWBAR.[BAR TYPE])<>"CAST IRON" And (RECVNEWBAR.[BAR
TYPE])<>"YELLOW BAR"));