ORM : Correction du SELECT (placement de la ',' avec gestion des fonctions et du 'distinct'

This commit is contained in:
xdrm-brackets 2016-07-25 11:25:25 +02:00
parent 8b23102e7c
commit d2d12e46af
1 changed files with 4 additions and 3 deletions

View File

@ -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++;
}