子查询返回一个以上的值

编程入门 行业动态 更新时间:2024-10-23 12:36:28
本文介绍了子查询返回一个以上的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

子查询返回了多个值.当子查询遵循=,!=,<,< =,>,> =时,或者当子查询用作表达式时,这是不允许的. 说明:执行当前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.

更多推荐

子查询返回一个以上的值

本文发布于:2023-10-24 17:14:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1524525.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!