SQLTeam.com | Weblogs | Forums

Query help

sql2008

#1

Hi,
I am trying to form query between 2 table
Both tables having Columns ID, Amount and Date.

Need to update the table 1 amount with table 2 amount. but some dates in table2 got missing. for that case i need to consider the most recent date. eg)

Table1
ID Amount Date
1 24 21/01/2017
2 35 04/01/2017
3 34545 09/12/2015
4 3454 11/01/2014
5 45 05/01/2017
6 68 28/01/2017
7 77 14/03/2016
10 26 21/01/2015

Table2

ID Amount Date
1 24 21/01/2017
2 35 04/01/2017
3 34545 09/12/2015
4 3454 11/01/2014
5 45 05/01/2017
6 29 25/01/2017
6 09 24/01/2017
7 88 13/03/2016
10 26 21/01/2015

for the ID 6 i need to consider the record with date 25/01/2017

thanks
Subha