试图从这里的几个表中构建一个查询,并在最终确定它时遇到困难:
表 1(电路)
t1.circuit_id
t1.circuit_name
(样本数据)
1234, test1
1235, test2
1236, test3
表 2(账户)
t2.account_id
t2.account_username
(样本数据)
100, user1
101, user2
102, user3
表 3(作业)
t3.circuit_id
t3.assignment1 (references table 2 (account_id))
t3.assignment2 (references table 2 (account_id))
t3.assignment3 (references table 2 (account_id))
(样本数据)
1234, 100, 101, 102
1235, 101, 101, 101
1236, 102, 102, 102
我所追求的结果如下:
t1.circuit_id, t3.assignment1, t2.account_username, t3.assignment2, t2.account_username, t3.assignment3, t2.account_username.
1234, 100, user01, 101, user02, 102, user03
1235, 101, user02, 101, user02, 101, user02
1236, 102, user03, 102, user03, 102, user03
非常感谢,--a