>I thought I could as part of the UDF. The problem is, I don't know what the syntex of the UDF should be. I thought a UDF would be good here, otherwise I have to include the CostBeforeCf and CF in the grouping clause.
Here's is an example.
CREATE FUNCTION UnitCost (@CostBeforeCF Decimal (9,2), @CF int )
RETURNS CHAR(20)
AS
BEGIN
RETURN CAST( CAST(@CostBeforeCF / @CF AS Decimal (9,2)) AS char(20))
END
--sb--