my %DataHash; #get all values where the 'Data' colume = 'value'...? my $sth = $dbh->prepare(" select ID, Data from table_name where Data=\"value\" "); $sth->execute; while ( my ( $ID, $Data) = $sth->fetchrow ) { $CountryDisplay{$ID} = "$Data"; # storing Data colum } # end-while $sth->finish