Hi Ken :)
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
SELECT id, cityAb, offPPG, @rownum := @rownum +1 AS rank
FROM team_stats t
SELECT @rownum :=0
ORDER BY t.offPPG DESC
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?
I love it when a program comes together - jdhannibal