I have a table that contains the next columns:
ip(varchar 255), index(bigint 20), time(timestamp)
each time something is inserted there, the time column gets current timestamp. I want to run a query that returns all the rows that have been added in the last 24 hours. This is what I try to execute:
SELECT ip, index FROM users WHERE ip = 'some ip' AND TIMESTAMPDIFF(HOURS,time,NOW()) < 24
And it doesn't work. Can someone help me out? Thanks :)