|
@@ -2024,12 +2024,12 @@ public class SQLiteProvider : IProvider
|
|
|
{
|
|
|
return calculation switch
|
|
|
{
|
|
|
- AggregateCalculation.Sum => TResult == typeof(decimal) ? "DECIMAL_SUM" : "SUM",
|
|
|
- AggregateCalculation.Count => "COUNT",
|
|
|
- AggregateCalculation.Maximum => "MAX",
|
|
|
- AggregateCalculation.Minimum => "MIN",
|
|
|
- AggregateCalculation.Average => "AVERAGE",
|
|
|
- AggregateCalculation.Concat => "GROUP_CONCAT",
|
|
|
+ AggregateCalculation.Sum => TResult == typeof(decimal) ? "DECIMAL_SUM({0})" : "SUM({0})",
|
|
|
+ AggregateCalculation.Count => "COUNT({0})",
|
|
|
+ AggregateCalculation.Maximum => "MAX({0})",
|
|
|
+ AggregateCalculation.Minimum => "MIN({0})",
|
|
|
+ AggregateCalculation.Average => "AVERAGE({0})",
|
|
|
+ AggregateCalculation.Concat => "GROUP_CONCAT(DISTINCT {0})",
|
|
|
_ => throw new Exception(string.Format("{0}.{1} is not a valid aggregate", columnname, calculation)),
|
|
|
};
|
|
|
}
|
|
@@ -2742,7 +2742,11 @@ public class SQLiteProvider : IProvider
|
|
|
if (fieldmap.TryGetValue(column.Name, out string? value))
|
|
|
{
|
|
|
if (aggregates != null && aggregates.TryGetValue(column.Name, out var aggregateFnc))
|
|
|
- combined[constants != null ? column.Name : String.Format("{0:D8}", combined.Keys.Count)] = string.Format("{0}({1}) as [{2}]", aggregateFnc, value, column.Name);
|
|
|
+ {
|
|
|
+ var _col = string.Format(aggregateFnc, value);
|
|
|
+ combined[constants != null ? column.Name : String.Format("{0:D8}", combined.Keys.Count)] =
|
|
|
+ string.Format("{0} as [{1}]", _col, column.Name);
|
|
|
+ }
|
|
|
else
|
|
|
combined[constants != null ? column.Name : String.Format("{0:D8}", combined.Keys.Count)] = string.Format("{0} as [{1}]", value, column);
|
|
|
}
|