Skip to content
Advertisement

Find first N rows that have unique value with mod(id, N)

For example, N is 10 and a table looks like

Need to find first N rows that have unique value with mod(id, N).

Expected result is

I’ve tried something like

but not working.

Advertisement

Answer

You can use window function here –

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