Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在构建一个横幅旋转系统,在我的 sql 表中,我有一个日期时间字段来存储横幅何时加入打印队列,以及一个字段在它离开时存储。当我加载页面时,我需要一个查询来显示队列中的所有内容。
我试过这个没有成功:
SELECT * FROM banners WHERE banner_start_date <= NOW() AND banner_end_date >= NOW()
我将它与 PHP 一起使用。
提前致谢!
尝试
SELECT * FROM banners WHERE now() between banner_start_date AND banner_end_date