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

Implement SELECT DISTINCT(...) #201

Open
OleksiiKachan opened this issue Aug 7, 2021 · 2 comments
Open

Implement SELECT DISTINCT(...) #201

OleksiiKachan opened this issue Aug 7, 2021 · 2 comments

Comments

@OleksiiKachan
Copy link
Member

Is your feature request related to a problem? Please describe.
Recently I had to build select distinct using bookshelf/knex which was pretty frustrating. and realized that metasql is lacking this feature

Describe the solution you'd like
was thinking of something like
db.select(table, ["DISTINCT(column)"])
current implementation treats "DISTINCT(COLUMN)" as a column name
or
db.select(table, ["column1", {column2: 'distinct'}]).groupBy(column2)
opened for other suggestions

@OleksiiKachan OleksiiKachan mentioned this issue Aug 8, 2021
5 tasks
@tshemsedinov
Copy link
Member

Case 1

db.select('Entity1', ['column1', 'column2']).distinct()
SELECT DISTINCT "column1", "column2" FROM "Entity1"

Case 2

db.count('Entity1', ['column1']).distinct()
SELECT COUNT(DISTINCT "column1") FROM "Entity1"

@tshemsedinov
Copy link
Member

distinct is not a function

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

2 participants