Distinct
Distinct is used to return the unique set of result. Distinct filters the result for all columns together except Primary column, since Primary column will make the result always unique.
Note :- If you want to return the distinct results based on some columns, then you should use GroupBy.
Sql
Select Distinct * From Table_Name;
JsStore
const results = await connection.select({
from: "Table_Name",
distinct: true, // optional boolean value - default false
})
//results will be array of objects.
console.log(results);