trying to build a query from a few tables here, and getting stumped on finalizing it:
Table 1 (circuits)
t1.circuit_id
t1.circuit_name
(sample data)
1234, test1
1235, test2
1236, test3
Table 2 (accounts)
t2.account_id
t2.account_username
(sample data)
100, user1
101, user2
102, user3
Table 3 (assignments)
t3.circuit_id
t3.assignment1 (references table 2 (account_id))
t3.assignment2 (references table 2 (account_id))
t3.assignment3 (references table 2 (account_id))
(sample data)
1234, 100, 101, 102
1235, 101, 101, 101
1236, 102, 102, 102
What I’m after is a result like following:
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
Many thanks,
–a
1 Answer