avram icon indicating copy to clipboard operation
avram copied to clipboard

Distinct doesn't work when using upper

Open snadon opened this issue 4 years ago • 2 comments

# works
UserQuery.new
  .preload_role
  .where_groups(GroupQuery.new.id.in(groups.map &.id))
  .email
  .upper
  .asc_order

# works
UserQuery.new
  .preload_role
  .where_groups(GroupQuery.new.id.in(groups.map &.id))
  .email
  .asc_order
  .distinct

# doesn't work (for SELECT DISTINCT, ORDER BY expressions must appear in select list)
UserQuery.new
  .preload_role
  .where_groups(GroupQuery.new.id.in(groups.map &.id))
  .email
  .upper
  .asc_order
  .distinct

snadon avatar May 27 '21 22:05 snadon

Just writing what I've learned...

In order for this to work, you'd have to update the select to include UPPER(user.email) and avram doesn't provide a way to model the selections right now.

matthewmcgarvey avatar Jul 09 '21 20:07 matthewmcgarvey

That's fine. We can close this issue if there's no plan to change the selection.

snadon avatar Jul 14 '21 22:07 snadon