update books set price=(select round((select price from books where id=1)/2,1)) where id=1
下面來說明
1.
select price from books where id=1
查出妳要更新的初始價格是多少
2.
用select round(數字,精度)來四舍五入
例如select round(63.543,1)
結果為63.5
3.
將四舍五入的值更新到表中
update books set price=(select round((select price from books where id=1)/2,1)) where id=1
希望樓主能有用