As discussed in the comment section, without knowing ordering of data it would not be possible to retrieve the output, because select does not guarantee it will output in insertion order, unless you have a column to determine it.And every calculation done on grouping similar timestamp could lead to different output in different runs.