Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
12.09 のように小数点以下 2 桁の数字があります。すべてを x9.90 または xx9.90 に丸めたい。
xxx.90 に丸める次のコードがあります。
UPDATE x SET y = ROUND(col,1,2) + CASE WHEN y -(ROUND(col,1,2)) BETWEEN .00 AND .89 THEN .90 ELSE .90 END;
これはうまくいくはずです:
UPDATE mytable SET col = col + CASE WHEN MOD(col, 10) <= 9.9 THEN 9.9 - MOD(col, 10) -- for x0.00 - x9.90 ELSE 19.9 - MOD(col, 10) -- for x9.91 - x9.99 END