Need a Sql Query

I want a Sql query to round the prices

for example  if the price is 5.01 then it should round it to 5 like wise we want to round the pennies. please send me a query for this. please let me know if my quey is correct , if not please correct it


update tablename set price=round(price,2) where pricelist='USD'

Thanks


gladstonesheebaAsked:
Who is Participating?
 
Patrick MatthewsConnect With a Mentor Commented:
update tablename set price=round(price,0) where pricelist='USD'
0
 
Naveen KumarProduction Manager / Application Support ManagerCommented:
round(price,0) -- this is to round to the nearest integer ( so we will not have decimals )

round(price,1) -- this is to round to the 1 decimal point. if you have 5.13, it gives 5.1 for this.

Thanks
0
 
abithCommented:
hi gladstonesheeba

Change the DataType to numeric(10,0) for that table.

Regards
Abith K
0
All Courses

From novice to tech pro — start learning today.