Change SQL request to display preview

This commit is contained in:
Michael RICOIS 2012-05-23 13:35:29 +00:00
parent 0f922f7d02
commit c343c5197a

View File

@ -222,8 +222,18 @@ class ComptageController extends Zend_Controller_Action
}
$sql = $dbMetier->select()
->from('etablissements_act', $extractSql)
->where('concat(siren, nic) IN('.join(',', $sirets).')');
->from('etablissements_act', $extractSql);
$i = 0;
$where = '';
foreach($sirets as $siret) {
if ($i>0) {
$where.=' OR ';
}
$where.= "(siren='".substr($siret,0,9)."' AND nic='".substr($siret,9,5)."')";
$i++;
}
$sql->where($where);
$result = $dbMetier->fetchAll($sql);
$liste = array();