对于这个简单的查询,如何回显最早的datecommented
的{{1}}时间戳(以分钟为单位)?
loginid
答案 0 :(得分:1)
您可以要求MySQL按特定顺序为您提供行:
SELECT loginid, datecommented
FROM comment
WHERE (HOUR(NOW()) - HOUR(datecommented)) <= 1
AND loginid = '$uid'
ORDER BY datecommented ASC
LIMIT 1 -- use this if you only want 1 row (ie: the oldest row)