Rather than fetch the data a row at a time using $sth->fetchrow, you might fetch all of the data ahead of time, with something like $sth->fetchall_arrayref. Then you can do pretty much whatever you like with them.
If the data are too large to fit comfortably in memory, this isn't the right approach. In that case, you're probably better off doing multiple queries (if you prepare the query ahead of time using $dbh->prepare, you may save some time over doing a $dbh->query every time).
Update: D'oh! That's fetchall_arrayref, not fetchrow_arrayref. Thanks pope and Flexx!
--
F
o
x
t
r
o
t
U
n
i
f
o
r
m
Found a typo in this node? /msg me
The hell with paco, vote for Erudil!
In reply to Re: sql record sets
by FoxtrotUniform
in thread sql record sets
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |