in reply to Re: Unique Array from DB
in thread Unique Array from DB
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}; };
|
|---|