-
Notifications
You must be signed in to change notification settings - Fork 664
Max
Mathias Rangel Wulff edited this page Jul 22, 2016
·
3 revisions
Maximal aggregator and function.
Syntax:
MAX([DISTINCT] expression) -- aggregator
MAX(expression1, expression2, ...) -- function
'null' will be treated as 0
so if you have unclean data its suggested that you make your own aggregation with user defined functions:
alasql.aggr.MOST = function(v,s,stage){
if(stage == 1) return v;
if(stage == 2) {
if(v == null) return s;
else return Math.max(s,v);;
}
return s;
};
var res = alasql('SELECT MOST(a) FROM ?',[data])
© 2014-2024, Andrey Gershun & Mathias Rangel Wulff
Please help improve the documentation by opening a PR on the wiki repo