首页新闻找找看学习计划

子查询返回的值不止一个。当子查询跟随在 =、!=、<、<=、>、>= 之后,或子查询用作

0
悬赏园豆:20 [已关闭问题] 关闭于 2013-04-26 13:43

insert into #tb_temp2(fnumber,fname)
select T_BC_ExpenseType.FNumber,T_BC_ExpenseType.FName_L2
from T_BC_ExpenseType inner join (select distinct SUBSTRING(fnumber,1,7) as fnumber from #tb_temp2) as #tb_temp3
on T_BC_ExpenseType.FID=#tb_temp3.fnumber

 

 

(select distinct SUBSTRING(fnumber,1,7) as fnumber from #tb_temp2) as #tb_temp3

这一句有多个值

整个sql的意思是获取费用类型的上级然后插入到#tb_temp2中

问题补充:

改成in 也不行

insert into #tb_temp2(fnumber,fname)
select T_BC_ExpenseType.FNumber,T_BC_ExpenseType.FName_L2
from T_BC_ExpenseType where FNumber in (select distinct SUBSTRING(fnumber,1,7) as fnumber from #tb_temp2)

szny的主页 szny | 初学一级 | 园豆:60
提问于:2013-04-26 11:05
< >
分享
所有回答(1)
0

解决了,是其他sql出错,感谢关注

szny | 园豆:60 (初学一级) | 2013-04-26 13:43
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册