0

I'm trying to calculate some data but I need the RANK() function. Sadly, PhpMyAdmin doesn't have it.

This is the Model Model

And this is how the query should be

SELECT bom.bom_id, RANK() OVER (PARTITION BY earlier_bom.bom_id ORDER BY bom.bom_id) AS pathIndex FROM bom RIGHT JOIN earlier_bom WHERE [condition]

Using this example I should get the PathIndex column.

I already got the Depth and Parent ID, but I can't get the index, so if you know another option to create a query similar to rank function it would be apreciated!

Example

Result

teph
  • 23
  • 4
  • `rank()` is not hierarchical. You would seem to need recursive CTEs -- which MyQL also doesn't support. – Gordon Linoff Feb 05 '18 at 00:11
  • This might be of help https://stackoverflow.com/q/3333665/1415724 and http://fellowtuts.com/mysql/query-to-obtain-rank-function-in-mysql/ and https://dba.stackexchange.com/questions/13703/get-the-rank-of-a-user-in-a-score-table – Funk Forty Niner Feb 05 '18 at 00:19

0 Answers0