Why use a hash and sort yourself when the DB can do that already?
select ... order by account_name, username
then, in Perl:
my $last_account; while (my $row = $sth->fetchrow_arrayref({ Slice => {})) { if (! defined $last_account or $last_account ne $row->{account_nam +e}) { if (defined $last_account) { print "\n"; }; $last_account = $row->{account_name}; print "Account $last_account\n", }; print $row->{username}; };
In reply to Re^2: Unique Array from DB
by Corion
in thread Unique Array from DB
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |