MySQL Forums
Forum List  »  Perl

Good return on mysql command line bad return in perl DBI
Posted by: Bobby Jones
Date: April 15, 2009 03:55AM

So I have a table which contains records that look something like this:

team_id:team_name:points
1:Team1:200
2:Team2:100
3:Team3:500
and so on.

When I run the following query from mysql command line it returns exactly what I want.

SELECT *, (@rownum := 0)
FROM (SELECT @rownum := @rownum+1 AS rank, team_id, team_name, points FROM teams order by points DESC) AS derived_table;

This exact same query in perl using DBI return al the data but rank is undef instead of where they would rank in points. Has anyone else had this problem? Is my approach to this problem even the right one? I am worried that this will not be efficient if I get a few million rows in teams. Am I right? Any constructive feed back would be great.

Options: ReplyQuote


Subject
Written By
Posted
Good return on mysql command line bad return in perl DBI
April 15, 2009 03:55AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.