You’re confusing what GROUP BY does with what you actually want. GROUP BY collapses rows with identical values into single rows for aggregation - that’s why you’re losing the sequential duplicates. You don’t need grouping at all since you want to keep every occurrence of person_id in its original spot. Just use SELECT person_id FROM Activities ORDER BY sequence_num and you’ll get exactly what you’re after. I’ve seen this mix-up before - sometimes the simplest query without any grouping is the right answer.
GROUP BY won’t maintain the order you need as it only aggregates unique values. Instead, you should query the table directly and order by sequence_num to retrieve all occurrences of person_id in their original sequence: SELECT person_id FROM Activities ORDER BY sequence_num;. This way, duplicates are preserved, and the desired order is achieved.