0

I have 2 table in a ms sql database prod_curs_test and rebuturi_test.
I want to update some fields in prod_curs_test with data from rebuturi_test. I used this to do that:

update dbo.prod_curs_test
set dbo.prod_curs_test.cant_rebuturi = (SELECT     dbo.rebuturi_test.Cantitate
FROM         dbo.rebuturi_test CROSS JOIN
                      dbo.prod_curs_test
WHERE     dbo.rebuturi_test.Comanda = dbo.prod_curs_test.Comanda)
where exists (SELECT     dbo.rebuturi_test.Cantitate
FROM         dbo.rebuturi_test CROSS JOIN
                      dbo.prod_curs_test
WHERE     dbo.rebuturi_test.Comanda = dbo.prod_curs_test.Comanda)

But it returns this error:

"Msg 512, Level 16, State 1, Line 2
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.

(0 row(s) affected)"

What I did wrong??

Tnx for any suggestion.

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by peter_budo
0

It has been solved, somebody please close the topic.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.