mariadb - Substract MYSQL timestamp fixed amount of hour where ID is something -
i want create line removes specific timestamp specific id, utilize mariadb , havn'ut figured out how to.
x = hr maybe 2 hours timestamp = name of table y = user id
what want like:
remove x amount of hours timestamp id y
my timestamp format not date it's = 1414254628 below on same table. timestamp = 1414254628 timestamp2 = 1413646379
hope help, thanks!
sorry code blocks but had error on posting thread had create them codes
if understand correctly , store epoch time in timestamp column can subtract required number of seconds it
class="lang-sql prettyprint-override">select timestamp - 3600 * 2 newtimestamp -- subtract 2 hours users user_id = 1
here sqlfiddle demo
...how update value?
by using update
update users set timestamp = timestamp - 3600 * 2 user_id = 1;
here sqlfiddle
mysql mariadb
No comments:
Post a Comment