gpt4 book ai didi

更多子查询的 MYSQL 渗透率

转载 作者:行者123 更新时间:2023-11-29 11:12:34 26 4
gpt4 key购买 nike

请您帮忙看看问题出在哪里。

MYSQL

Select NameList_name from NameList where NameList.id In  
(Select NameList.id from NameList where id_company =
(Select company.id From company where company_company Like "XY"))
And
(Select id_NameList from NameListGoods where id_NameListGoodsKind =
(Select NameListGoodsKind.id from NameListGoodsKind where NameListGoodsKind_NameListGoodsKind LIKE "XX"))
And
(Select id_NameList from NameListStateFrom where id_StateFrom =
(Select StateFrom.id from StateFrom where StateFrom_state Like "XXX"))
And
(Select id_NameList from NameListStateTo where id_StateTo =
( Select StateTo.id from StateTo where StateTo_state Like "XYX"));

这返回了“”SQL Server 子查询返回了超过 1 个值“”强文本我想搜索:从 NameList 中选择 NameList_name,其中 NameList.id正确的 NameList.id 渗透率从其他子查询返回什么。

示例:

表格名单:

ID   Name    
1 a
2 b
3 c
4 d
5 e

子查询1:

(Select NameList.id from NameList where id_company = 
(Select company.id From company where company_company Like "XY"))

返回给我:数字:1,4,5

子查询2:

(Select id_NameList from NameListGoods where id_NameListGoodsKind = 
(Select NameListGoodsKind.id from NameListGoodsKind where NameListGoodsKind_NameListGoodsKind LIKE "XX"))

返回给我:数字 2,4,3

子查询3:

(Select id_NameList from NameListStateFrom where id_StateFrom = 
(Select StateFrom.id from StateFrom where StateFrom_state Like "XXX"))

返回给我:数字 3,4,1

子查询4:

(Select id_NameList from NameListStateTo where id_StateTo = 
(Select StateTo.id from StateTo where StateTo_state Like "XYX"));

返回给我:数字 5,4,2,1

头部查询

此结果的外显率为 4。然后我需要向我显示 Namelist 中的名称,其中 Namelist.id=4;

感谢帮助,

最佳答案

SELECT a.id
FROM (SUBQUERY 1) a
JOIN (SUBQUERY 2) b
ON b.id = a.id
JOIN (SUBQUERY 3) c
ON c.id = a.id
JOIN (SUBQUERY 4) d
ON d.id = a.id;

关于更多子查询的 MYSQL 渗透率,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40284911/

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