in reply to Re^2: DBI hashref does not return data in order of query
in thread DBI hashref does not return data in order of query

For portability reasons, I'd not use {NAME} at all, but {NAME_lc} or {NAME_uc}. If you do not want to pull out the column names out of the statement handle, (why not btw?), you can do something like ...

my $sth; my @columns = qw( col1 col2 col3 col4 col5 col6 ); { local $" = ","; $sth = $dbh->prepare ( "select @columns ftom table where day = '10-08-2007' order by +col3, col4"); } $sth->execute; while (my $row = $sth->fetchrow_hashref) { ... }

Enjoy, Have FUN! H.Merijn