PostgreSQL
 sql >> Database >  >> RDS >> PostgreSQL

Salta ogni ennesima riga di risultati in PostgreSQL

Se usi PostgreSQL, puoi usare row_number() :

SELECT t.*
FROM (
  SELECT *, row_number() OVER(ORDER BY id ASC) AS row
  FROM yourtable
) t
WHERE t.row % 5 = 0