JsStore supports following aggregate functions : -

  • Count : Returns the number of rows of specified column.
  • Sum : Returns the total sum of numeric column.
  • Avg : Returns the average value of numeric column.
  • Max : Returns the maximum value of specified column.
  • Min : Returns the minimum value of specified column.
Sql
  • Select min(Column_Name) From Table_Name;
JsStore
  • Connection.select({
  • From: "Table_Name",
  • Aggregate: {
  • Min: Column_Name,
  • // You can specify multiple columns at a time by giving the columns name in an array.
  • // Count:['column1','column2']
  • },
  • OnSuccess:function (results){
  • //aggregate result will be in the first index only.
  • console.log(results[0]);
  • },
  • OnError:function (error) {
  • alert(error.value);
  • }
  • };

Example Next