Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Correlated Updates

Author  Topic 

Cyclonik
Posting Yak Master

114 Posts

Posted - 2006-02-02 : 13:00:55
I am not really clear yet on proper syntax for Correlated Updates. I have the following update which does not work. I wrote this out just to get my intention across.

UPDATE VehicleOwner set vo.PartyID = parent.newPartyID
from VehicleOwner vo join MatchPArty mp on vo.partyID = mp.partyid,
(select Max(PartyID) newPartyID, groupid from MatchParty group by groupid) parent
where vo.GroupID = parent.GroupID

I hope its clear what my intention is.

shallu1_gupta
Constraint Violating Yak Guru

394 Posts

Posted - 2006-02-02 : 23:03:21
Try this..
UPDATE
vo
set vo.PartyID = parent.newPartyID
from
VehicleOwner vo
join MatchPArty mp
on vo.partyID = mp.partyid
Join
(select Max(PartyID) newPartyID, groupid from MatchParty group by groupid)
parent
on
vo.GroupID = parent.GroupID
Go to Top of Page
   

- Advertisement -