Anyone know how I can build a query that concatena...
# exposed
d
Anyone know how I can build a query that concatenates two columns before using a LIKE test? For example,
Copy code
Users.select { concat(Users.firstName, stringLiteral(" "), Users.lastName) like "%${search}%") }
but that's not valid. Planned here https://kotlinlang.slack.com/archives/C0CG7E0A1/p1502141543702309?thread_ts=1502104984.024287&cid=C0CG7E0A1 but not sure if it was ever added
s
Copy code
Users.select(Users.firstName, Users.lastName)
    .where { 
        (Users.firstName + " " + Users.lastName) like "%${search}%"
    }
The
select { }
was an alias for
selectAll().where { }
. The API seems to have slightly changed. Most convenient you can use
+
, alternatively use
concat(" ", listOf(Users.firstName, Users.lastName)) like "%${search}%"
.