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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-03-10 : 07:47:58
|
| Fritz writes "Hi Guys, I want to update the rows in Table ONE from table TWO where table TWO holds multiple records that match the key of Table ONE, but I only want to use the newest records in Table TWO. I do have a datetime stamp on eah record in Table TWO.ThanksFritz" |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2005-03-10 : 08:06:55
|
update t1set col1 = t2.col1--, other columns to updatefrom ONE t1inner join TWO t2 on t1.id = t2.idinner join (select id, max(DateCol) as DateCol from TWO group by id) t3 on t2.id = t3.id and t2.DateCol = t3.DateColGo with the flow & have fun! Else fight the flow |
 |
|
|
|
|
|