tjb
02/19/2019, 6:38 AMreturn transaction {
PostDAO.wrapRows(
Posts
.innerJoin(PostsTags, {Posts.id}, {<http://PostsTags.post|PostsTags.post>})
.innerJoin(Tags, {Tags.id}, {PostsTags.tag})
.selectAll()
.andWhere {
Posts.title like "%$query%" or (Tags.name inList tags)
}
.withDistinct()
).map {
it.toModel()
}
.distinct()
.toList()
}tapac
02/19/2019, 9:06 AMselect {} instead of selectAll().andWhere{}. select is the alias to sql where.tjb
02/19/2019, 4:30 PM