diff --git a/lib/aggregate.ex b/lib/aggregate.ex index 7f78350..520c938 100644 --- a/lib/aggregate.ex +++ b/lib/aggregate.ex @@ -73,7 +73,7 @@ defmodule AshSql.Aggregate do |> Enum.split_with(&already_added?(&1, query.__ash_bindings__, [])) query = - if Enum.any?(already_computed_aggregates) do + if Enum.any?(already_computed_aggregates) && select? do query.__ash_bindings__.bindings |> Enum.filter(fn {_binding, %{type: :aggregate}} -> true