K
Kysely13mo ago
ohmi

Using MySQL functions in SELECT statement

Hi! Just trying to migrate over from Knex. Skimmed over the documentation but still unsure of how to replicate this query in Kysely, or might be looking in the wrong place? In Knex, I'd often have to use selectRaw for these SELECT a, b, UPPER(c) FROM x;
3 Replies
ohmi
ohmi13mo ago
Figured it has to do with db.fn , but not quite sure how to fit it in to make things happy
await db.selectFrom("x").select(["a", "b", db.fn("UPPER", ["c"]))
await db.selectFrom("x").select(["a", "b", db.fn("UPPER", ["c"]))
Unknown User
Unknown User13mo ago
Message Not Public
Sign In & Join Server To View
ohmi
ohmi13mo ago
awesome, thanks!
Want results from more Discord servers?
Add your server
More Posts