Ok Editing this...
SELECT *
FROM votelog
WHERE ipaddress = '127.0.0.1'
AND datevoted
BETWEEN DATE_SUB( CURDATE( ) , INTERVAL 24 HOUR )
AND CURDATE( )
LIMIT 0 , 30
That is an example of the query I am attempting to run to find posts within the past 24 hours. I am also running a separate one for different needs for in the past 60 minutes. Issue is there is at least 4 rows in the table I am testing with 3 of which fall under the 24 hour clause.
Edit
Ok so I figured out my problem, 1 Im to damn tired.. 2 Horrible use of Between and Date_Sub.. It didn't dawn on me till now I should have been using the col name where I have CURDATE() going to answer my own question below.
this is what the timestamp in the DB looks like, standard DATETIME.. 2011-09-01 13:20:08
with that being said I am yielding no results.
解决方案
You are not using BETWEEN correctly, the correct syntax is:
expr BETWEEN min AND max
you should change the end of your query to:
...BETWEEN DATE_SUB(CURDATE(), INTERVAL 24 hour) AND CURDATE()
or use > operator.