Calculate based on the records within the group and fill the result into the first record — From SQL to SPL #8

Problem description & analysis:
The id and nbr of the MS SQL database table are grouping fields. After sorting the records within the group by time field dt, the order of 0 and 1 in the s...