denodb icon indicating copy to clipboard operation
denodb copied to clipboard

[Feature] Support SQL `SELECT DISTINCT`

Open codemaster138 opened this issue 2 years ago • 0 comments

Currently, there doesn't seem to be a way to select only distinct records from a database.

I believe this should be reasonably easy to implement by simply adding a distinct() static method to Model, which would lead to the following api:

const flightDestinations = Flight
  .select('destination')
  .distinct()
  .get();

Which would generate the SQL query:

SELECT DISTINCT destination FROM flights;

codemaster138 avatar Sep 23 '22 11:09 codemaster138