I'm using the following query that another Stackoverflow user helped me with, it's completely new to me:
"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"
It's working fine, but I realized I hadn't got the value 'timestamp'
coming through from the database. How can I add timestamp
to the query so I can echo it in my results?
'timestamp'
is stored in the transactions
table.
Thanks.
采用
"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"
you need to just add t.timestamp
in your query.
"SELECT CONCAT(u1.firstname,' ',u1.lastname) as sender,CONCAT(u2.firstname,'
',u2.lastname) as receiver, t.points as points, t.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"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.