-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
[ENHANCEMENT]: Implementation of distinct #119
Comments
I think the aggregate function (groupBy) will work the same as DISTINCT. import map from './map';
const db = map.sqlite('demo.db');
getAggregates();
async function getAggregates() {
const orders = await db.order.aggregate({
where: x => x.orderDate.greaterThan(new Date(2022, 0, 11, 9, 24, 47)),
customerId: x => x.customerId,
customerName: x => x.customer.name,
numberOfLines: x => x.count(x => x.lines.id),
totals: x => x.sum(x => lines.amount)
});
} |
Will it work for you ? |
Hello Iroal, thank you for the fast answer. I know that the GROUP is the same but I read somewhere that for huge quantity of data GROUP BY is less efficient. However for little quantity of data, there is no difference of performance. Anyway I think that using RAW query for this specific case is not absurd. |
I can always add distinct. Much of it will just be copy paste from the aggregate function. |
Feature Description
Hello I am not sure it is really possible as I think "distinct" is not existing in all SQL language but do you plan to implement it ?
I see that in your example you use it with RAW queries only.
Thank you for your feedback
The text was updated successfully, but these errors were encountered: