Delete from join

Is it possible to do something like this:
DELETE P
FROM Product P
LEFT JOIN OrderItem I ON P.Id = I.ProductId
WHERE I.Id IS NULL
DELETE P
FROM Product P
LEFT JOIN OrderItem I ON P.Id = I.ProductId
WHERE I.Id IS NULL
With the ORM? e.g.
DB.delete(Product).leftJoin(OrderItem, eq(Product.id, OrderItem.productId).where(...);
DB.delete(Product).leftJoin(OrderItem, eq(Product.id, OrderItem.productId).where(...);
Or do I need to write the full SQL statement in raw sql?
2 Replies
Angelelz
Angelelz13mo ago
joins are not available in a delete statement in Drizzle yet The workaround is do it in a DB.execute()
BaNuni
BaNuni9mo ago
any update on this?
Want results from more Discord servers?
Add your server