Correction SQL : Activité réglementée

This commit is contained in:
Michael RICOIS 2016-11-04 10:19:04 +01:00
parent cd9cc5cb94
commit 219b083e72

View File

@ -6440,15 +6440,17 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
}
$stmt = $this->conn->executeQuery("SELECT infoTel, count(*) AS nb FROM jo.telephonie
WHERE siren=$siren $strNic AND typeTel='an8' ORDER BY nb DESC LIMIT 0,1");
WHERE siren=$siren AND typeTel='an8' ORDER BY nb DESC LIMIT 0,1");
if ($stmt->rowCount()) {
$result = $stmt->fetch(\PDO::FETCH_OBJ);
$an8en = $result->infoTel;
$stmt = $this->conn->executeQuery("SELECT infoTel FROM jo.telephonie
WHERE siren=$siren $strNic AND typeTel='an8' ORDER BY dateProvPartenaire DESC LIMIT 0,1");
if ($stmt->rowCount()) {
$result = $stmt->fetch(\PDO::FETCH_OBJ);
$an8et = $result->infoTel;
if ($result->nb > 0) {
$an8en = $result->infoTel;
$stmt = $this->conn->executeQuery("SELECT infoTel FROM jo.telephonie
WHERE siren=$siren $strNic AND typeTel='an8' ORDER BY dateProvPartenaire DESC LIMIT 0,1");
if ($stmt->rowCount()) {
$result = $stmt->fetch(\PDO::FETCH_OBJ);
$an8et = $result->infoTel;
}
}
}