$sql = "SELECT t1.target_id, SUM(t1.cnt) as hm, t2.id, t2.name, t2.second_name, t2.avatar, t2.studyGroup FROM votes AS t1, people AS t2 WHERE t1.target_id=t2.id GROUP BY t2.id ORDER BY hm DESC, t2.name ASC LIMIT ?";
$o1 = $this->DB->prepare($sql);
$args = array(
$this->rl_count
);
$o1->execute($args);
$this->rl_count
это 20. $q = $dbh->prepare("select ... limit :limit");
$q->bindValue(':limit', 10, PDO::PARAM_INT);
$q->execute();