Help with MySQL query

Posted by Michael S. on Stack Overflow See other posts from Stack Overflow or by Michael S.
Published on 2010-05-17T11:58:53Z Indexed on 2010/05/17 12:10 UTC
Read the original article Hit count: 285

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 :)

© Stack Overflow or respective owner

Related posts about sql

Related posts about mysql