Skip to main content

Aggregate Functions

An aggregate function performs a calculation on multiple values and returns a single value.

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.
  • list : Returns all matching value inside an array.

Sql

Select min(Column_Name) From Table_Name;

JsStore

const results = await connection.select({
from: "Table_Name",
aggregate: {
min: Column_Name,
// You can specify multiple columns at a time by providing columns name in an array.
// count:['column1','column2']
}
});
//aggregate result will be in the first row only.
console.log(results[0]);

Example