douhan9748 2011-10-28 15:12
浏览 8
已采纳

如何查询此列,以便仅采用上周内的条目

I have column called 'last updated' of this format: 2009-10-13 09:20:30 and I want to select all entries in the column that have a date that is within the last 7 days of the time the query is ran. I am using php in the backend for this query along with mysql.

I am constructing a large query, this will be part of it.

Thanks very much if you can help me.

  • 写回答

3条回答 默认 最新

  • donglinxin8765 2011-10-28 15:16
    关注

    A short example on how to do this:

    SELECT *
    FROM yourtable AS t1
    WHERE t1.last_updated > DATE_SUB(NOW(), INTERVAL 7 DAY);
    

    The documentation can be found here in the MySQL manual.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器