Bornyls Deen
05/20/2020, 9:43 AMselect distinct on
(cats.name) cats
from
groups_cats
inner join
cats
on
groups_cats.cat_id = cats.id
where
groups_cats.cat_id = 25
order by
cats.name, groups.created desc
I've managed to come up with this
GroupsCats
.join(Cats, JoinType.INNER) { Cats.id eq GroupsCats.catId }
.select { GroupsCats.catId eq catId }
.orderBy(Cats.created to SortOrder.DESC)
But I can't figure out how to make the result distinct on a particular column (cat name in this case)... the withDistinct()
method sounded hopeful but doesn't seem to work in the way that I need.
If anyone has any ideas/suggestions I would really appreciate it.Kenneth Wußmann
05/20/2020, 11:41 AMEvan R.
05/20/2020, 12:22 PMBornyls Deen
05/20/2020, 1:27 PMwithDistinct()
method allows you to grab a single column but not retrieve entire rows with a distinct filter on one column if that makes sense.withDistinct()
so I might be missing something.Evan R.
05/20/2020, 1:37 PM