非常感谢任何帮助。
我现在正在使用这个查询。
SELECT t.itemID, RepID, InsRepairID
FROM tbl_item t
left join tbl_insiderepair i on i.itemID = t.itemID
left join tbl_underrepair u on u.itemID = t.itemID
where(i.itemID = t.itemID Or u.itemID = t.itemID);
这是结果。
itemID | RepID | InsRepairID
1 3 null
2 null 1
3 null 2
现在我想将“RepID 和 InsRepairID 列”(它们是来自不同表的 ID)变成一个列。
最佳答案
通过使用 Union,您可以在一列中添加两个表
Select itemID, RepID from tbl_item
union
SELECT itemID,InsRepairID from tbl_insiderepair
关于数据库;一列中的不同 ID?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32622331/