[Israel.pm] Sorting By MySQL DATETIME Fields?

Gaal Yahas gaal at forum2.org
Wed Jun 16 02:34:18 PDT 2004

On Wed, Jun 16, 2004 at 12:14:49PM +0300, Yuval Yaari wrote:
> I had a query that used JOIN and took too much time (4 seconds).
> I figured Perl could handle it much faster, and so it did.
> I am using 2 queries now.
> At the end, I have an array of $sth->fetchrow_hashref() which I would
> like to sort by date (since it's in 2 queries, I can't ORDER BY Date).
> Is there a module or hack to do this?

Can't you just sort the array?

@sorted = sort { $a->{datefield} <=> $b->{datefield} } @unsorted;

Gaal Yahas <gaal at forum2.org>

More information about the Perl mailing list