i have my app configuration values in table for example.
id appid keyValue dataValue
1 app1 hitcount 3
2 app1 lasthit 2022-03-23 13:15:56
i was trying to write a query in MySQL to reset hitcount = 0 if lasthit date change for example if 23 changed to 24 i want to reset 0 hitcount i wrote this query but getting error [Error Code: 1093.].
update appconfig
SET dataValue = IF ( (select day(dataValue)
from appconfig
where appid = 'app1'
and keyValue = 'lasthit'
) > day(utc_timestamp()),0,dataValue
)
where appid = 'app1'
and keyValue = 'hitcount'
Please advice