选择时间戳早于 [英] select timestamp older than
本文介绍了选择时间戳早于的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何从数据库中选择12小时以上的物品? 我使用时间戳列存储时间,但我认为我只需要年,月,日 我有这样的东西,但它行不通(从表中返回所有数据都没有错误)
How i can select from database the items older than 12 hours?! I using a timestamp column to store the time but I don't think i need year,month,day only hours I have something like this but it dosen't work (no error just returning all data from table)
$sql = "SELECT *FROM Y WHERE X and time > now() - INTERVAL 12 HOUR";
类型:时间戳
Type : timestamp
您说得对SalmanA.谢谢
You're right Salman A .Thanks
推荐答案
尝试一下:
SELECT * FROM Y WHERE X and time < (NOW() - INTERVAL 12 HOUR)
要选择12小时以上的记录,您需要<
而不是>
you need <
rather than >
as you want to select records older than 12 hours
这篇关于选择时间戳早于的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文