I have two columns A and B in SQL. Column A has value 5.2 and Column B has value 2.1. I am multiplying column A and B in Column C. Answer is 10.92. I would like to get rounded number 11 as Integer in column C instead of 10.92 as float or decimal. How should I write query. Should there be a Cast function or similar?
Sample query is:
SELECT *, A multiply B As C FROM Table X
Advertisement
Answer
You need query like this:
select *, cast(round((a*b), 0) as int) from X
Here you can see on DB FIDDLE