MERGE INTO using arbitrary values
Hi 👋🏽
I'm trying to construct a MERGE query using arbitrary values based on this stackoverflow answer.
Here's the example from that post:
I'm struggling to figure out how to do the
USING
clause with kysely. I'm trying to do it with the values
helper from the kysely docs, but .mergeInto
doesn't seem to have an equivalent to insertInto
's .expression
method, so I can't figure out if that can be made to work.
Thanks for the help!Extending kysely | Kysely
In many cases, Kysely doesn't provide a built-in type-safe method for a feature. It's often because adding
Solution:Jump to solution
Thanks, that's almost perfect (you did make a mistake, the alias for values should have been 'vals').
For posterity's sake, here's the full query to get output SQL matching the example:
```
const rows = await db...
2 Replies