我第一次用这个。
SELECT classroom .cls_id,
classroom.cls_name,
u1.users_id as users_id1,
u2.users_id as users_id2
FROM classroom
INNER JOIN clsown
ON clsown.cls_id = classroom .cls_id
INNER JOIN users AS u1
ON clsown.users_id = u1.users_id
INNER JOIN users AS u2
ON clsown.users_id = u2.users_id
我明白了:
cls_id cls_name users_id1 users_id2
1 -------- room1 ------- 1 --------- 1
1 -------- room1 ------- 2 --------- 2
2 -------- room2 ------- 3 --------- 3
2 -------- room2 ------- 4 --------- 4
我想看看
cls_id cls_name users_id1 users_id2
1 -------- room1 ------- 1 --------- 2
2 -------- room2 ------- 3 --------- 4
我不知道如何进行内部连接。我究竟做错了什么?
感谢您的回答。