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 - 2011-08-27 : 15:22:19
|
| I need to loop through a recordset and get some max and min records from another table I tried doing this by creating a temp table c but when I do update #c set firsttransaction=MIN(dc) from log t left join #c c on c.number=t.numberand I get an errorAn aggregate may not appear in the set list of an UPDATE statement.How can I do this - I want to be able to get the max and min from the log table for each record in #c |
|
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2011-08-27 : 15:41:56
|
| update #c set firsttransaction=MinDC from (SELECT Min(DC) AS MinDC, number FROM log Group By number) t left join #c c on c.number=t.number--Gail ShawSQL Server MVP |
 |
|
|
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2011-08-28 : 08:55:06
|
| thanks :) |
 |
|
|
|
|
|