in reply to Re: Ranking MySQL Entries?
in thread Ranking MySQL Entries?
The following SQL statement works, but I don't know how to implement it using perl so it returns their rank.
SELECT MAX( x.rank ) AS rank FROM ( SELECT id, cityAb, offPPG, @rownum := @rownum +1 AS rank FROM team_stats t JOIN ( SELECT @rownum :=0 )r ORDER BY t.offPPG DESC )x WHERE x.cityAb = 'Jax'
If I had some perl code that would order a set of records by a specific column, and then return the row number of the record that matches the query (in the above example, whichever city equals 'Jax'), then I could get it to work. So the above SQL statement works perfectly, I just don't know how to implement it through perl. I'm using DBI.
Hope that helps?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Ranking MySQL Entries?
by Corion (Patriarch) on Nov 20, 2013 at 18:09 UTC | |
by jdlev (Scribe) on Nov 20, 2013 at 20:05 UTC | |
by Corion (Patriarch) on Nov 20, 2013 at 20:07 UTC | |
|
Re^3: Ranking MySQL Entries?
by kcott (Archbishop) on Nov 21, 2013 at 00:31 UTC |