子查询返回多个值时如何编写更新查询? [英] How to write update query when subquery returns multiple value?

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

问题描述

我有一个问题:

I have a query :

update DeviceDefinitionSettingValues set devicedefinitionsettingxrefid=(Select DeviceDefinitionSettingXrefID from DeviceDefinitionSettingXref
where DeviceDefinitionID='6E269410-670F-4E02-9792-E3E15CD9AA49')





子查询返回多个值。执行时我收到此消息:

子查询返回的值超过1值。当子查询遵循=,!=,<,< =,>,> =或子查询用作表达式时,不允许这样做。



我能做什么或如何即兴发表我的查询。

我是SQL的新手



The subquery returns mulltiple values.On executing i get this message:
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

What can i do or how can i improvise my query.
I am new to SQL

推荐答案

你可以使用TOP 1 in子查询
You can use TOP 1 in Sub Query


这篇关于子查询返回多个值时如何编写更新查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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