用于在某些行中编辑字段的SQL脚本 [英] SQL Script to Edit a Field in some rows

查看:120
本文介绍了用于在某些行中编辑字段的SQL脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请寻求帮助

我正在尝试在几行中编辑一个字段,但一直收到此错误.

错误消息

消息512,级别16,状态1,过程UpdateCustomerExport,第7行
子查询返回了1个以上的值.当子查询遵循=,!=,<,< =,>,> =或将子查询用作表达式时,不允许这样做.
该声明已终止.




我的代码是

Please can soemone help

I am trying to edit a field in several rows but keep getting this error.

Error Message

Msg 512, Level 16, State 1, Procedure UpdateCustomerExport, Line 7
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.




My Code is

Update SLCustomerAccount SET AnalysisCode3 = 'O21 Merchant/Commercial Shipping'
where AnalysisCode3 = 'C21 Merchant/Commercial Shipping'



谢谢
Stephen



Thank you
Stephen

推荐答案

是的,因为您正在使用的子查询返回的值大于值.在这里用IN 关键字替换您的运算符其他运算符(无论您使用什么,可能是>,<,< =,> =).像这样尝试:
Yes, because the subquery you are using is returning more than value. Here replace your operator other operator(Whatever you are using, it may be >, <, <=, >=) with IN keyword. Try like this:
SELECT * FROM tblTemp WHERE UserID IN(SELECT * FROM tblUsers)





--Amit





--Amit


这篇关于用于在某些行中编辑字段的SQL脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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