``` return transaction { PostDAO.wrapRows...
# exposed
t
Copy code
return 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()
    }
t
It's better to use
select {}
instead of
selectAll().andWhere{}
.
select
is the alias to sql
where
.
👍 1
t
i will refactor! thank you @tapac