How can I multiply two types?
I have one column with cost of type money
. Another column that has the number of those products of type integer
.
How can I multiply these two values to result in a value representing the cost?
Example: $2000 * 2
How can I multiply two types?
I have one column with cost of type money
. Another column that has the number of those products of type integer
.
How can I multiply these two values to result in a value representing the cost?
Example: $2000 * 2
DECLARE @UNITS int
DECLARE @UnitCost money
SET @UNITS = 100
SET @UnitCost = 2.20
SELECT (@UNITS * CONVERT(decimal(18,2), @unitcost)) as Total
Replace the @variables with your column names.
Use:
SELECT t.number_of_items * t.cost_of_item AS total_cost
FROM PRODUCTS t