stapleman527
Programmer
I am working on a data migration project in which I have account data that I am massaging into a new format. I am also filtering out data that is not needed in the new system. For each account I can have 1 to n records that represent updates to the account and I want to create a query that will return the most recent record for each account number. See below:
Start Data:
Account_Num | First_Name | Last_Name | Open_Date
12345 Joe Blow 09/10/2004
12345 Joe Blew 09/11/2004
12346 Jane Smith 10/12/2007
12347 Sandy Back 02/24/2007
12347 Cindy Black 02/22/2007
12347 Sandy Black 02/23/2007
End Data:
Account_Num | First_Name | Last_Name | Open_Date
12345 Joe Blew 09/11/2004
12346 Jane Smith 10/12/2007
12347 Sandy Back 02/24/2007
I am using MS SQL Server, but will be putting this in a script along with other transformations to be run in a 3rd party tool so I would like to stick to as much basic SQL as possible.
Thanks,
Jonathan
Start Data:
Account_Num | First_Name | Last_Name | Open_Date
12345 Joe Blow 09/10/2004
12345 Joe Blew 09/11/2004
12346 Jane Smith 10/12/2007
12347 Sandy Back 02/24/2007
12347 Cindy Black 02/22/2007
12347 Sandy Black 02/23/2007
End Data:
Account_Num | First_Name | Last_Name | Open_Date
12345 Joe Blew 09/11/2004
12346 Jane Smith 10/12/2007
12347 Sandy Back 02/24/2007
I am using MS SQL Server, but will be putting this in a script along with other transformations to be run in a 3rd party tool so I would like to stick to as much basic SQL as possible.
Thanks,
Jonathan