neldelesndblogtagscontactresume
neldelesndblogtagscontactresume

2019 May 27throw_number() in MySQLsql 

How to implement `row_number()` in MySQL.


In Redshift I frequently use the row_number() function. However the version of MySQL our DB uses doesn't support this.

To work around it can use:

SELECT a.i, a.j, count(*) as row_number FROM test a JOIN test b ON a.i = b.i AND a.j >= b.j GROUP BY a.i, a.j

Appendix

source