in the recent study of mysql, I intend to use a live chat system to practice. The following is a user name, an information table
users table, with structural data as shown in figure
msgs,
2,
1
2
.
Thank God for his answer. The answer is as follows
SELECT b.id as "ID" ,b.alias as "" ,a.fromId as "id",b.alias as "",a.toId as "id",
c.alias as "", a.content as ""
FROM msgs as a
INNER JOIN users as b
ON a.fromId = b.id
INNER JOIN users as c