gpt4 book ai didi

mysql - 使用得到的结果集再次查询

转载 作者:行者123 更新时间:2023-11-29 21:04:46 27 4
gpt4 key购买 nike

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

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列查看上述查询的集体结果。我怎样才能做到这一点?

最佳答案

您可以使用多个联接来查询数据库,如下所示:

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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com