my $sth = $dbh->prepare('SELECT DISTINCT email FROM contacts WHERE ? = ? ORDER BY email'); $sth->execute($value1,$value2) or die $sth->errstr;