子查询返回一个以上的值 [英] Subquerry return more than one value

查看:68
本文介绍了子查询返回一个以上的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

子查询返回了多个值.当子查询遵循=,!=,<,< =,>,> =时,或者当子查询用作表达式时,这是不允许的.
说明:执行当前Web请求期间发生未处理的异常.请查看堆栈跟踪,以获取有关错误及其在代码中起源的更多信息.


是否可以检查哪个子查询返回多个值?

Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.


Is there a way to check which subquerry returns more than one value?

推荐答案

使用而不是=


我相信您的查询会像这样
Use In Instead of =


i believe your query will look like this
Select * from tbl1 where col1=(select col1 from tbl2)



在此处使用In运算符



Use In operator here

Select * from tbl1 where col1 in (select col1 from tbl2)


您必须执行每个子查询才能知道哪个返回多行.
You have to execute each sub-query to know which returns more than one row.


这篇关于子查询返回一个以上的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆