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 |
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2012-09-18 : 15:09:21
|
my query is update b set numsent=COUNT(id) from drep d left join #batches b on b.batchnumber=d.batch where b.batchnumber=d.batchI get an error An aggregate may not appear in the set list of an UPDATE statement.how can I change this I'm trying to update my temporary table with a count from another table |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-09-18 : 15:13:25
|
looks like this is what you're afterupdate b set numsent= d.cntfrom (select batch,COUNT(id) as cnt from drep group by batch) d inner join #batches b on b.batchnumber=d.batch ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|