Requete Etablissement LEFT JOIN
This commit is contained in:
parent
7220a171a1
commit
00958fa103
@ -1060,7 +1060,6 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
$result = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||
$nbTot = $result->nb;
|
||||
|
||||
$sqlWhere.= "AND p.codePaysInsee=e.adr_com";
|
||||
$sqlOrder = "ORDER BY triSiege DESC, e.actif DESC, e.nic DESC";
|
||||
$sqlLimit = "LIMIT $deb, $nbRep";
|
||||
|
||||
@ -1084,13 +1083,16 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
WHERE siren IN ($strSiren) AND siege=1");
|
||||
$result = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||
$nbTot = $result->nb;
|
||||
$sql = "SELECT $fields FROM jo.etablissements e, jo.tabPays p
|
||||
WHERE siren IN ($strSiren) AND siege=1 AND p.codePaysInsee=e.adr_com
|
||||
$sql = "SELECT $fields FROM jo.etablissements e
|
||||
LEFT JOIN jo.tabPays p ON p.codePaysInsee=e.adr_com
|
||||
WHERE siren IN ($strSiren) AND siege=1
|
||||
ORDER BY e.rang DESC, e.actif DESC, e.nic ASC $sqlLimit";
|
||||
$strInfo = 'Siren saisi invalide';
|
||||
}
|
||||
} else {
|
||||
$sql = "SELECT $fields FROM jo.etablissements e, jo.tabPays p WHERE $sqlWhere $sqlOrder $sqlLimit";
|
||||
$sql = "SELECT $fields FROM jo.etablissements e
|
||||
LEFT JOIN jo.tabPays p ON p.codePaysInsee=e.adr_com
|
||||
WHERE $sqlWhere $sqlOrder $sqlLimit";
|
||||
}
|
||||
|
||||
try {
|
||||
@ -1212,8 +1214,9 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
WHERE TEL=$id OR FAX=$id $filtreActif");
|
||||
$result = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||
$nbTot = $$result->nb;
|
||||
$stmt = $this->conn->executeQuery("SELECT $fields FROM jo.etablissements e, jo.tabPays p
|
||||
WHERE TEL=$id OR FAX=$id $filtreActif AND p.codePaysInsee=e.adr_com
|
||||
$stmt = $this->conn->executeQuery("SELECT $fields FROM jo.etablissements e
|
||||
LEFT JOIN jo.tabPays p ON p.codePaysInsee=e.adr_com
|
||||
WHERE TEL=$id OR FAX=$id $filtreActif
|
||||
ORDER BY e.siege DESC, e.actif DESC $limit");
|
||||
}
|
||||
elseif ($typeId == 'AUTRE') {
|
||||
@ -1259,8 +1262,9 @@ class Metier_Insee_MInsee extends Metier_Insee_Table
|
||||
WHERE autre_id IN ('$strId') $filtreActif $strDep");
|
||||
$result = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||
$nbTot = $result->nb;
|
||||
$stmt = $this->conn->executeQuery("SELECT $fields FROM jo.etablissements e, jo.tabPays p
|
||||
WHERE autre_id IN ('$strId') $filtreActif $strDep AND p.codePaysInsee=e.adr_com
|
||||
$stmt = $this->conn->executeQuery("SELECT $fields FROM jo.etablissements e
|
||||
LEFT JOIN jo.tabPays p ON p.codePaysInsee=e.adr_com
|
||||
WHERE autre_id IN ('$strId') $filtreActif $strDep
|
||||
ORDER BY siege DESC $limit");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user