I have a query that accept the scalar-valued function 2 times, at one place in the field within the select list and second in the join condition. My question is that how to avoid that function call within single query? Thanks.
SELECT i.Id, i.Name, . . . . . dbo.IsItemCApproved(C.Id) AS [Status], . .
FROM @Item i
JOIN Card C ON C.ItemId = i.Id
AND C.Deadline IS NOT NULL
AND dbo.IsItemCApproved(C.Id) = 'False'
AND C.IsDeleted = 0
{}). Asif has already suggested an edit, you should just need to approve it.