I need some support regard a MySQL query.
I really don’t know if possible to do that only via MySQL query, as I would like to skip a complex PHP function.
I have this query in a PHP script that update my database every 5 minutes (via CRON) from a parsed XML feed:
INSERT INTO $jackpot->gameId (gameId,gameName,amount,currency,date,hit,hit_date) VALUES (\"$jackpot->gameId\", \"$jackpot->gameName\" , \"$jackpot->amount\", \"$jackpot->currency\",CURRENT_DATE(),0,NULL) ON DUPLICATE KEY UPDATE amount=$jackpot->amount
Now, I would “enhance” this query.
I need to UPDATE the “hit” and “hit_date” columns when the “amount” value is down (for example) of a 90% of the previous value.
Something like this, in two words (no query)
Execute query-->update rows-->check if 'amount' value is down 90%--> if yes --> update hit (set to 1) and update hit_date (CURRENT_DATE()).
Is possible to do that via MySQL or I have to write a more complex php script?
Any help would be really appreciated! Thank you!
You’ve hardly provided any code to go off here, so I’m guessing you are using
mysqliotherwise please adapt: