S
S
Sergey Erin2020-02-04 21:12:43
SQL
Sergey Erin, 2020-02-04 21:12:43

How to increase only the integer part of the amount?

Hello, in the database the amount of goods is stored as 71207.0000. It needs to be increased by 3%. After sql query it is 73343.2100. How to increase the sum, affecting only the integer part of the number? Now the sql is like this:
UPDATE `oc_product` SET price=price*1.03;

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
netyshka, 2020-02-05
@artalexs

ROUND(price*1.03, 0);
Data type must be decimal

A
Antonio Solo, 2020-02-04
@solotony

to start with, STORE MONEY AMOUNT ONLY BIGINT in minimum units (penny, cents)

K
Konstantin Tsvetkov, 2020-02-05
@tsklab

SELECT CEILING( 71207.0000 * 1.03), FLOOR( 71207.0000  * 1.03 )

73344 73343
And if verbatim:
SELECT FLOOR( 71207.0000 ) + FLOOR( FLOOR( 71207.0000 ) * 0.03 )

73343

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question