Skip to content

[Feature] Support SQL SELECT DISTINCT #361

Open
@codemaster138

Description

@codemaster138

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;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions