Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Support SQL SELECT DISTINCT #361

Open
codemaster138 opened this issue Sep 23, 2022 · 0 comments
Open

[Feature] Support SQL SELECT DISTINCT #361

codemaster138 opened this issue Sep 23, 2022 · 0 comments

Comments

@codemaster138
Copy link

codemaster138 commented Sep 23, 2022

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 codemaster138 changed the title Support SQL SELECT DISTINCT [Feature] Support SQL SELECT DISTINCT Sep 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant