I am performing a multiplication that requires two columns from two different tables, and then using the results in a separate query. I think this would be possible as a view:
SELECT SUM(A.salesAmt * B.sales%) AS rebateAmount
But would a table-valued function be possible here, or more appropriate? Could both table A and B be passed as parameters to return the final rebateAmount
as a sum?
- Table A contains:
salesID, salesAmt
- Table B contains:
salesID, sales%
Would like the TVF to return the sum of (salesAmt * sales%) as rebateAmount
if possible? This is SQL Server 2014.
Thanks in advance.