Re: Ordinal number within a table
Harald Fuchs <[email protected]>
| Newsgroups | gmane.comp.db.mysql.perl |
|---|---|
| Organization | Linux Private Site |
| Message-ID | <[email protected]> |
In article <B4448B75FF74124ABB5793D8BFBEEA3901C13CAB__14941.5178261281$1119975129$gmane$org@exccpgo04.corp.xcelenergy.com>, "Kapoor, Nishikant" <[email protected]> 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, <fields> FROM <tables> 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/[email protected]