add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
13 rows affected
ID JoiningDt DocNum ClosestDt rn
1 2024-04-05 00:00:00.000 A123 2024-04-07 00:00:00.000 1
2 2024-04-06 00:00:00.000 A123 2024-04-07 00:00:00.000 2
4 2024-04-07 00:00:00.000 A123 2024-04-08 00:00:00.000 1
5 2024-04-08 00:00:00.000 A123 2024-04-09 00:00:00.000 1
3 2024-04-04 00:00:00.000 B123 2024-04-05 00:00:00.000 1
ID JoiningDt DocNum rn (No column name)
1 2024-04-05 00:00:00.000 A123 1 2024-04-07 00:00:00.000
2 2024-04-06 00:00:00.000 A123 2 2024-04-08 00:00:00.000
3 2024-04-04 00:00:00.000 B123 1 2024-04-05 00:00:00.000
4 2024-04-07 00:00:00.000 A123 1 2024-04-08 00:00:00.000
5 2024-04-08 00:00:00.000 A123 1 2024-04-09 00:00:00.000
ID JoiningDt DocNum NearestDate
1 2024-04-05 00:00:00.000 A123 2024-04-07 00:00:00.000
2 2024-04-06 00:00:00.000 A123 2024-04-08 00:00:00.000
3 2024-04-04 00:00:00.000 B123 2024-04-05 00:00:00.000
4 2024-04-07 00:00:00.000 A123 2024-04-09 00:00:00.000
5 2024-04-08 00:00:00.000 A123 2024-04-11 00:00:00.000