View Single Post
Old 02-08-2008, 04:28 PM   #5 (permalink)
RobertK
The Addict
Top Contributor Good Samaritan 
 
Join Date: Jan 2008
Location: USA
Posts: 217
Thanks: 16
RobertK is on a distinguished road
Default

Yeah, I was digging in my MySQL reference book, since Srev got me interested, and I think this would be a better method:
sql Code:
SELECT * FROM `my_table` WHERE TIMESTAMPDIFF(HOUR, `access`, TIME()) <= 24;

That makes it a whole lot simpler than what I thought of before. However it does require MySQL 5.0 and upwards.
__________________
Programmers are in a race with the Universe to create bigger and better idiot-proof programs, while the Universe is trying to create bigger and better idiots. So far the Universe is winning. - Rich Cook
RobertK is offline  
Reply With Quote
The Following User Says Thank You to RobertK For This Useful Post:
WinSrev (02-08-2008)