Conditional insert
Hi,
Is there a way to do an
insert
only if the result of an exists
statement is true
?
I would like to do it in one query instead of having to check with another query before the insert.
Thanks4 Replies
Can you show how you would do it in plain SQL?
The thing is I don't actually know if it's possible in plain SQL 😅
You might want to take a look at https://orm.drizzle.team/docs/crud#onconflict-and-upsert-insert-or-update
Querying with SQL-like syntax [CRUD] – DrizzleORM
Drizzle ORM | %s
Specifically,
onConfictDoNothing()
method