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

Aggregate functions on lucid relations don't respect relation #48

Closed
nrempel opened this issue Sep 12, 2016 · 1 comment
Closed

Aggregate functions on lucid relations don't respect relation #48

nrempel opened this issue Sep 12, 2016 · 1 comment
Assignees

Comments

@nrempel
Copy link

nrempel commented Sep 12, 2016

e.g.,

I can query by a hasManyThrough relation:

yield location
  .experiences()
  .fetch();

But if I try to count like so:

yield location
  .experiences()
  .count();

Then, it gives me the count for all experiences, not just experiences related to that relation.

The SQL generated is select count(*) from "experiences but it should be something like select count(*) from "experiences" inner join "customers" on "customers"."id" = "experiences"."customer_id" where "customers"."location_id" = 2;

Thanks!

@thetutlage
Copy link
Member

Great, will get it fixed

@thetutlage thetutlage self-assigned this Sep 13, 2016
thetutlage added a commit that referenced this issue Jul 16, 2017
aggregates support have been added to the relationships

Closes #48
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