ORM : Correction du SELECT (placement de la ',' avec gestion des fonctions et du 'distinct'
This commit is contained in:
parent
cbfb39a116
commit
5836c06983
|
@ -262,7 +262,7 @@
|
||||||
foreach($fields as $field=>$select){
|
foreach($fields as $field=>$select){
|
||||||
|
|
||||||
/* (1) On construit le nom du champ */
|
/* (1) On construit le nom du champ */
|
||||||
$fieldStr = ($c==0) ? "$table.$field" : ", $table.$field";
|
$fieldStr = "$table.$field";
|
||||||
|
|
||||||
/* (2) On ajout le DISTINCT s'il y a lieu */
|
/* (2) On ajout le DISTINCT s'il y a lieu */
|
||||||
if( isset($select[1]) && $select[1] )
|
if( isset($select[1]) && $select[1] )
|
||||||
|
@ -275,10 +275,11 @@
|
||||||
|
|
||||||
/* (4) On ajoute l'alias */
|
/* (4) On ajoute l'alias */
|
||||||
if( isset($select[0]) && !is_null($select[0]) )
|
if( isset($select[0]) && !is_null($select[0]) )
|
||||||
$sql .= "$fieldStr as agg_$field";
|
$fieldStr = "$fieldStr as agg_$field";
|
||||||
else
|
else
|
||||||
$sql .= "$fieldStr";
|
$fieldStr = "$fieldStr";
|
||||||
|
|
||||||
|
$sql .= ($c==0) ? "$fieldStr" : ", $fieldStr";
|
||||||
|
|
||||||
$c++;
|
$c++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue