gpt4 book ai didi

php - 如何修改此 PHP 查询以添加数据库值 'timestamp'?

转载 作者:太空宇宙 更新时间:2023-11-03 12:07:44 25 4
gpt4 key购买 nike

我正在使用另一个 Stackoverflow 用户帮助我完成的以下查询,这对我来说是全新的:

"SELECT CONCAT(u1.firstname,' ',u1.lastname) as sender,CONCAT(u2.firstname,' 
',u2.lastname) as receiver, t.points as points FROM transactions t INNER JOIN users u1 ON
u1.id=t.sender_id INNER JOIN users u2 ON u2.id=t.receiver_id ORDER BY date DESC limit 5"

它工作正常,但我意识到我没有从数据库中获取值 'timestamp'。如何将 timestamp 添加到查询中,以便在结果中回显它?

'timestamp' 存储在 transactions 表中。

谢谢。

最佳答案

使用

"SELECT CONCAT(u1.firstname,' ',u1.lastname) as sender,CONCAT(u2.firstname,' ',u2.lastname) as receiver, t.points as points, t.timestamp as timestamp FROM transactions t INNER JOIN users u1 ON u1.id=t.sender_id INNER JOIN users u2 ON u2.id=t.receiver_id ORDER BY date DESC limit 5"

关于php - 如何修改此 PHP 查询以添加数据库值 'timestamp'?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25698801/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com