我有2个表,其中一个包含2个创建者和经理的用户ID
第一张表
creator_id manager_id status
-----------------------------
2 - 1 - closed
第二张表
user_id user_name
-------------------
1 | Tom
2 | George
我需要获取如下数据
creator_id| manager_id status
-----------------------------
George | Tom | closed
答案 0 :(得分:0)
尝试这样的事情......
select st.user_name as creator_id, sst.user_name as manager_id, ft.status
from first_table ft
join second_table st on ft.creator_id= st.user_id
join second_table sst on ft.manager_id= sst.user_id;