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.
Author |
Topic |
vk18
Posting Yak Master
146 Posts |
Posted - 2006-10-18 : 12:56:30
|
Hello Friends,I am trying to update a table based on another table values, and i am using aggregate function in that. It is not allowing me to use aggregate in update. how to deal with this.ThxUpdate tbldetail set ActualTotals = sum(tblspot.rateactual) as rateactual from tbldetail inner join tblspot on tbldetail.pkid = tblspot.fkdetail |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-10-18 : 13:51:48
|
[code]Update dset d.ActualTotals = x.rateactualfrom tbldetail dinner join ( SELECT fkdetail, SUM(rateactual) rateactual FROM tblspot GROUP BY fkdetail ) x ON x.fkdetail = d.pkid [/code]Peter LarssonHelsingborg, Sweden |
 |
|
vk18
Posting Yak Master
146 Posts |
Posted - 2006-10-18 : 14:08:53
|
Thx man Appreciate it |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-10-18 : 14:12:32
|
Also try this and compare performanceUpdate dset d.ActualTotals = (SELECT SUM(s.rateactual) FROM tblspot s WHERE s.fkdetail = d.pkid)from tbldetail d Peter LarssonHelsingborg, Sweden |
 |
|
|
|
|