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
ここで、timeはタイムスタンプです。
これを試して :
SELECT * FROM `chats` WHERE `chat_id` = 1 AND `time` >= DATE_SUB(NOW(), INTERVAL 1 HOUR); ORDER BY `time`