ref_id |
unit_id |
x_unit_id |
unit_address |
unit_name |
Date |
10001 |
12 |
1 |
A |
P |
01/01/2020 |
10001 |
22 |
2 |
B |
Q |
02/02/2020 |
10001 |
32 |
2 |
C |
R |
01/01/2020 |
10001 |
42 |
4 |
D |
S |
04/01/2021 |
unit_id is unique, I want to select latest unit_id by date for a particular ref_id and generate flag for unit_address change as Yes or No, if date is same select top record.
Group by ref_id and select top two max/latest dates and determine if there is change in unit_address if yes then show Yes else No
@swuehl @jagan @marcus_sommer @rwunderlich
Thanks & Regards,
Please Accepts as Solution if it solves your query.