我的 SQL 查询中的 DELETE 有什么问题?
我的 SQL 查询包含一个不起作用的方程。它看起来像这样:
$delete = ("DELETE FROM table WHERE $timecode - time < 86400");
基本上我想删除一天前记录的行(又名 86400s)。正如您所猜测的,$timecode
= time()
; time
列也是一个时间戳。
My SQL query contains an equation that doesn't function. Here is what it looks like:
$delete = ("DELETE FROM table WHERE $timecode - time < 86400");
Basically I want to delete the rows that are recorded a day ago (aka 86400s). As you can guess, $timecode
= time()
; and the time
column is also a time stamp.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最好的猜测是表中的时间列与时间函数混淆了。第二个问题:从你的描述来看,你不想要>>而不是
Best guess is that the time column in your table is confused with the time function. Second problem: from your description, don’t you want > instead of <?
这对你有用吗?
$delete = "从表中删除 WHERE (NOW()-86400) > 时间";
Does this work for you?
$delete = "DELETE FROM table WHERE (NOW()-86400) > time";