Re: Ordinal number within a table

Re: Ordinal number within a table

am 28.06.2005 18:53:13 von Harald Fuchs

In article ,
"Kapoor, Nishikant" writes:

> I could, but I am assigning the entire resultset in one shot to another construct as follows:

> my $str = "SELECT \@row:=\@row+1 as row, FROM WHERE ...";
> my $sth = $conn->prepare($st);
> $sth->execute();
> return $sth->fetchall_arrayref( {} );

Just change the last line to

my $n = 0;
return [ map { [ ++$n, @$_ ] } @{$sth->fetchall_arrayref} ];

What's the problem?


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org