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
Angelelz16mo ago
joins are not available in a delete statement in Drizzle yet The workaround is do it in a DB.execute()
BaNuni
BaNuni12mo ago
any update on this?

Did you find this page helpful?