Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有 2 张桌子
table_A内的列:数据、id_A、id_B、状态
table_B内的列:id、用户名
我想从table_A(id_A和id_B)内的列中显示来自table_B引用的用户名,并将别名id_A设为User_1,将id_B设为User_2
我一直在使用 INNER JOIN 但它仍然让我感到困惑
你能试试这个吗...
SELECT a.username as User_1, b.username as User_2 FROM table_A t JOIN table_B b on b.id = t.id_B JOIN table_B a ON a.id = t.id_A