Adding values from different tables

Posted by damdeok on Stack Overflow See other posts from Stack Overflow or by damdeok
Published on 2012-11-11T04:45:20Z Indexed on 2012/11/11 5:00 UTC
Read the original article Hit count: 379

Filed under:

Friends, I have these tables:

Contestant Table:
Winner
Peter

Group Table:
Id Name Score Union
1 Bryan 3 77
2 Mary 1 20
3 Peter 5 77
4 Joseph 2 25
5 John 6 77

I want to give additional score of 5 to Peter on Group Table. So, I came up with this query.

UPDATE Group 
SET Score = Score+5
FROM Contestant, Group 
WHERE Contestant.Winner = Group.Name

Now, I want also to give additional score of 5 to the same Union as Peter which is 77.

How can I integrate it as one query to my existing query?

© Stack Overflow or respective owner

Related posts about sql-server-2005