在以下查询中,我想使用ii.instanceId(在以下查询中)从另一个表ipAddress中获取instanceinfo

Select ui.userId, ui.username, ui.userStatus, ui.organization, ii.instanceId from
userinfo as ui left join instanceallotmentinfo as ii on ui.accountId = ii.accountId
where userType != 4 AND userId != 1 order by userId asc LIMIT 0 , 10


获得ipAddress后,我想用ipAddress列查看上述查询的汇总结果。我该怎么办?

最佳答案

您可以使用multiple joins来查询数据库,如下所示:

Select ui.userId, ui.username, ui.userStatus, ui.organization,  iai.instanceId, ii.instanceIpAddress from
userinfo as ui
left join instanceallotmentinfo as iai on ui.accountId = iai.accountId
left join instanceinfo as ii on ii.instanceId = iai.instanceId;

关于mysql - 使用获得的结果集再次查询,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36911964/

10-16 18:24