There are two tables
message: id, from (iduser), to (iduser), message
user id
How to make a request from message so that as a result instead of from (iduser) was the name from the user table?
There are two tables
message: id, from (iduser), to (iduser), message
user id
How to make a request from message so that as a result instead of from (iduser) was the name from the user table?
To dereference two foreign keys you need two JOIN 'a.
SELECT u_from.name, u_to.name, message.message FROM message LEFT JOIN user AS u_from ON message.from_id = u_from.id LEFT JOIN user AS u_to ON message.to_id = u_to.id; JOIN 'a ... and respectively two copies of the user table. - AkinaSource: https://ru.stackoverflow.com/questions/825790/
All Articles
JOINdid not hear or did not master? - Fat-Zer