Slackbot
03/07/2023, 8:32 AMLuiz Augusto
03/07/2023, 2:23 PMstart and end out of the group by (and you can also get rid of the outer select by adding a having seg_num > 1 clause in the inner select)Ben Krug
03/08/2023, 12:34 AMand before group by. Also, like Daniel said, you might be able to do it in one query instead of an outer and inner query.