SQL-根据传递的值数量,更改子句值的数量
我已经加入了2个表,并试图根据顺序删除行。ID
DELETE order_attachment
FROM order
LEFT OUTER JOIN order_attachment
ON order.id=order_attachment.id
WHERE order.id = ?
现在问题是订单数量。ID可以是1、2或3,它们作为数组出现。 (例如[12311]或[12323,45612]或[23413,55675,32512])
我想用单个交易中的order_attachment表中的所有行中删除所有行。
问题
- 如何通过一次交易删除所有行?
- 如何根据OrderID数组长度更改
?
的数量? (1个问号长度是1、2,如果长度为2,则长度为3),如果长度为3)
谢谢!
I have joined 2 tables and trying to delete the rows based on the order.id
DELETE order_attachment
FROM order
LEFT OUTER JOIN order_attachment
ON order.id=order_attachment.id
WHERE order.id = ?
Now the problem is number of order.id can be 1, 2, or 3 and they come in as an array.
(Ex. [12311] or [12323, 45612] or [23413, 55675, 32512])
I want to delete all the rows in order_attachment table with the order.id with a single transaction.
Questions
- How can I delete all the rows with a single transaction?
- How can I change the number of
?
based on orderId array length?
(1 question mark if length is 1, 2 if length is 2, and 3 if length is 3)
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论