SOLVED

how insert round function

Copper Contributor

hi guys,

 

i am a beginner in SQL .

This is my query 

JD2021_0-1627507773501.png

 

This is the result .

JD2021_1-1627507841884.png

I want to convert the Annual_premium_In$ to a round figure.

How we can do that 

Thanks in Advance

 

 

3 Replies

I want to convert the Annual_premium_In$ to a round figure.

@JD2021 , you already used the right function name ROUND

ROUND (Transact-SQL) - SQL Server | Microsoft Docs

 

 

where can put the round function on the above mentioned query thanks in advance
best response confirmed by JD2021 (Copper Contributor)
Solution

Hi @JD2021 -- The query below will hopefully help you to get started.  Take care.

SELECT age,nationality,mp,
	convert(float,case
		when mp = 106 then ROUND(MP*12/3.65,2)
		when MP = 79 THEN ROUND(MP*12/3.65,2)
		when MP = 53 THEN ROUND(MP*12/3.65,2)
		when MP = 35 THEN ROUND(MP*12/3.65,2)
	else ROUND(MP/3.65,2)
	end) as Annual_Premium_In$
	FROM metlife..analysis

 

bake13_0-1627694385112.png

 

 

 

1 best response

Accepted Solutions
best response confirmed by JD2021 (Copper Contributor)
Solution

Hi @JD2021 -- The query below will hopefully help you to get started.  Take care.

SELECT age,nationality,mp,
	convert(float,case
		when mp = 106 then ROUND(MP*12/3.65,2)
		when MP = 79 THEN ROUND(MP*12/3.65,2)
		when MP = 53 THEN ROUND(MP*12/3.65,2)
		when MP = 35 THEN ROUND(MP*12/3.65,2)
	else ROUND(MP/3.65,2)
	end) as Annual_Premium_In$
	FROM metlife..analysis

 

bake13_0-1627694385112.png

 

 

 

View solution in original post