• So do a GROUP BY first and then break the results into groups. After that, 'explode' the results back into multiple rows if needed.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.