i have created fnDiscountPrice() that references the item id so that it will find the discount price for one item now I'm needing to find the total price of all the products with that ID. so i have a function that receives the ItemID and then multiplys the discount price found in fnDiscountPrice() with the same ID by the quantity. Code shown below.
CREATE FUNCTION dbo.fnItemTotal (@ItemID INT = 0) RETURNS Table RETURN (SELECT ItemID, SUM(dbo.fnDiscountPrice(@ItemID) * Quantity) AS TimeTotal FROM OrderItems GROUP BY ItemID)
I keep getting an error of "Cannot find either column "dbo" or the user-defined function or aggregate "dbo.fnDiscountPrice", or the name is ambiguous."