我需要一个函数,其中包含来自其他表的多个 WHERE 条件:
CREATE FUNCTION [dbo].[Table2](@Id INT)
RETURNS money
AS
BEGIN
DECLARE @cost money
SELECT @koszt = SUM(Value)
FROM [dbo].[Cost]
WHERE ([ID_CostCategory] --I need to add here one more condition [ID_Department]
return @cost
END
请帮助如何获得它。