I have a list of results with many duplicates on field time1.
I need to leave only one event of each time1 based on the following conditions:
The latest time2, that is earlier than time1
If no such exists, then leave any one, earliest would be preferred though
If time2 is "null" (string "null"), leave it (as it implies a unique time1 already)
Here's an example of what I mean, input:
time1, time2, key1, key2
00:14:00, 00:15:00, qwe, uiop
00:14:00, 00:13:30, asd, hjkl
00:14:00, 00:13:00, zxc, vbnm
00:13:00, 00:15:00, rty, zxcv
00:13:00, 00:14:00, fgh, asdf
00:12:00, null, tyu, qwer
Result:
time1, time2, key1, key2
00:14:00, 00:13:30, asd, hjkl
00:13:00, 00:14:00, fgh, asdf
00:12:00, null, tyu, qwer
The time difference between time1 and time2 as well as different time2's can be anywhere from seconds to weeks. I haven't figured out how to use stats like this, sounds simple enough though.
... View more