Simplification de la requete SQL
This commit is contained in:
parent
ec82b5e898
commit
9b58e2f961
@ -44,16 +44,15 @@ class GraphAppelsDureeMoyenne extends GraphBrouzouf{
|
|||||||
{
|
{
|
||||||
$num = 0;
|
$num = 0;
|
||||||
|
|
||||||
|
$sql = "SELECT date_format(td.date,'%Y%m'), sum(td.duree), count(td.duree)";
|
||||||
|
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details as td";
|
||||||
|
|
||||||
if ($this->client == 0 && $this->contrat == 0)
|
if ($this->client == 0 && $this->contrat == 0)
|
||||||
{
|
{
|
||||||
$sql = "SELECT date_format(date,'%Y%m'), sum(duree), count(duree)";
|
$sql .= " GROUP BY date_format(td.date,'%Y%m') ASC ";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details";
|
|
||||||
$sql .= " GROUP BY date_format(date,'%Y%m') ASC ";
|
|
||||||
}
|
}
|
||||||
elseif ($this->client > 0 && $this->contrat == 0)
|
elseif ($this->client > 0 && $this->contrat == 0)
|
||||||
{
|
{
|
||||||
$sql = "SELECT date_format(td.date,'%Y%m'), sum(td.duree), count(td.duree)";
|
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details as td";
|
|
||||||
$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as s";
|
$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as s";
|
||||||
|
|
||||||
$sql .= " WHERE td.ligne = s.ligne";
|
$sql .= " WHERE td.ligne = s.ligne";
|
||||||
@ -62,8 +61,7 @@ class GraphAppelsDureeMoyenne extends GraphBrouzouf{
|
|||||||
}
|
}
|
||||||
elseif ($this->client == 0 && $this->contrat > 0)
|
elseif ($this->client == 0 && $this->contrat > 0)
|
||||||
{
|
{
|
||||||
$sql = "SELECT date_format(td.date,'%Y%m'), sum(td.duree), count(td.duree)";
|
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details as td";
|
|
||||||
$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as s";
|
$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as s";
|
||||||
|
|
||||||
$sql .= " WHERE td.ligne = s.ligne";
|
$sql .= " WHERE td.ligne = s.ligne";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user