I am trying to update the entire data, but I need to divide the exchange rate by the margin rate on the purchase price, and data format error occurs.
SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect decimal value: 'buy_amt * 0.00097812555575316' for column 'prod' at row 1 (SQL: update prod set value = 10, price = buy_amt * 0.00097812555575316 )
my code:
DB::update("update prod set value = ?, price = ?, ",
[
$datas["value"],
"buy_amt * ".(1+($datas["value"]/100))/$datas["price"],
]);
prod table
price value datatype DECIMAL
buy_amt datatype INT
price | value | buy_amt
11 | 10 | 10
22 | 10 | 20