UPDATE Contact_UDF
SET hasAttendedEvent = (
SELECT CASE WHEN c.Contact_ID IN
(SELECT DISTINCT Contact_ID
FROM Action a
WHERE a.Action_Type_ID =39) THEN 1 ELSE 0 END
FROM Contact c)
我跑SQL的这个小位设置在Contact_UDF表中的国旗,但继续运行到以下错误:“子查询返回的值超过1个。”错误SQL管理
Msg 512, Level 16, State 1, Line 1 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.
我不能为我的生活理解为什么,因为我使用IN,而不是它描述的任何运营商。谁能帮忙?
错误说**或当子查询用作表达式时** – DavidG 2014-10-02 08:58:37
您使用的是MySQL还是SQLServer? – NickyvV 2014-10-02 09:45:29
你有两个子查询。其中一个遵循“=”,另一个遵循IN。 – user2338816 2014-10-02 12:08:40