每个Student
都有Teacher
自己的UNIQUE
UserID
是否可以一次从三个表中检索值?这样:它将显示UserID
每个人拥有的Student
或Teacher
?我尝试了以下查询,但它不起作用:
SELECT u.UserID, StudentID, TeacherID
FROM User u
INNER JOIN (SELECT * FROM Student, Teacher) ss
ON u.UserID = ss.UserID
每个Student
都有Teacher
自己的UNIQUE
UserID
是否可以一次从三个表中检索值?这样:它将显示UserID
每个人拥有的Student
或Teacher
?我尝试了以下查询,但它不起作用:
SELECT u.UserID, StudentID, TeacherID
FROM User u
INNER JOIN (SELECT * FROM Student, Teacher) ss
ON u.UserID = ss.UserID