troubleshooting Question

TSQL Date Update

Avatar of gvamsimba
gvamsimbaFlag for United Kingdom of Great Britain and Northern Ireland asked on
Microsoft SQL Server 2005
2 Comments1 Solution221 ViewsLast Modified:
     I have a table A with columns named id and date.. i need to
update this column as the min(date) from another
table B..i tried the below code but it is giving me an
error.. can any body give me the right code on how to update
my date column ? Many Thanks

update tableA
set secondorderdate= (select min(b.order_date)
from tableA   a
inner join tableB b
on a.ID=b.ID
group by a.ID)

Error - Subquery returned more than 1 value.
This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
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 2 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