Skip to content
Advertisement

Round Robin order in postgresql

Assume we have this table: ( each object can have an instance multiple times but with different timings for example object A has two instances of 1)

I want to order this table so that the objects are ordered in a round robin way but all the rows with the same instance should come together ordered by time)

Advertisement

Answer

Try this:

DEMO

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement