Excel MS Query - Issue with Cast
Posted on 2011-10-20
I'm trying to query some items and ran into an issue. I have the following:
SELECT ID, CAST((COST/QTY) AS DECIMAL(6,2) AS TOTAL,
(SELECT PART_ID, CAST((COST/QTY)) AS DECIMAL(6,2) AS TOTAL, DATE
FROM ITEM_TRANS WHERE TYPE = 'I' AND CLASS='R') X ON X.TOTAL = CAST((COST/QTY) AS DECIMAL(6,2))
AND X.PART_ID = X.ID
WHERE TYPE = 'O' AND CLASS = 'I'
AND ID = 'ABC888'
Incorrect column expression: 'CAST(COST/QTY) AS DECIMAL(6,2))'.
If I can't use cast, what can I use to convert my calculation so that it is 2 decimal places?