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.
我正在尝试使用 Web 服务器和 MySQL 创建聊天服务器。我希望它显示 1 小时内的最后一次聊天。现在我的查询是:
select * from chats where chat_id = 1 order by time
其中时间是时间戳。
尝试这个 :
SELECT * FROM `chats` WHERE `chat_id` = 1 AND `time` >= DATE_SUB(NOW(), INTERVAL 1 HOUR); ORDER BY `time`