troubleshooting Question

SQL Query error

Microsoft SQL Server
15 Comments1 Solution23 ViewsLast Modified:
Dear Expert,
I have this query in SQL 2016:

UPDATE    SalesOrderTemp
SET           SequenceNo =
                (SELECT     vSO_SalesOrderHistoryDetail.SequenceNo
FROM        SalesOrderTemp INNER JOIN
                  vSO_SalesOrderHistoryDetail ON SalesOrderTemp.SONo = vSO_SalesOrderHistoryDetail.SalesOrderNo
                  AND SalesOrderTemp.LineKey = vSO_SalesOrderHistoryDetail.LineKey
GROUP BY vSO_SalesOrderHistoryDetail.SequenceNo)

I have this error:
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

Where I am wrong?
Thanks in advance

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 15 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 15 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros