ORM : Correction du SELECT (placement de la ',' avec gestion des fonctions et du 'distinct'
This commit is contained in:
parent
8b23102e7c
commit
d2d12e46af
|
@ -262,7 +262,7 @@
|
|||
foreach($fields as $field=>$select){
|
||||
|
||||
/* (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 */
|
||||
if( isset($select[1]) && $select[1] )
|
||||
|
@ -275,10 +275,11 @@
|
|||
|
||||
/* (4) On ajoute l'alias */
|
||||
if( isset($select[0]) && !is_null($select[0]) )
|
||||
$sql .= "$fieldStr as agg_$field";
|
||||
$fieldStr = "$fieldStr as agg_$field";
|
||||
else
|
||||
$sql .= "$fieldStr";
|
||||
$fieldStr = "$fieldStr";
|
||||
|
||||
$sql .= ($c==0) ? "$fieldStr" : ", $fieldStr";
|
||||
|
||||
$c++;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue