初学者sql问题pt.2错误ora-00933 SQL命令未正确结束
我必须为 DBMS 中的作业更新表。不明白为什么我会收到此错误。
UPDATE Customers
SET CreditLimit = CreditLimit * 1.25
FROM(SELECT *
FROM Orders
WHERE Amount > 250
HAVING COUNT(*) >= 2);
有什么想法吗?
I have to update my tables for my assignment in DBMS. Can't figure out why I get this error.
UPDATE Customers
SET CreditLimit = CreditLimit * 1.25
FROM(SELECT *
FROM Orders
WHERE Amount > 250
HAVING COUNT(*) >= 2);
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如您所指定的,
update
语句没有from
子句。你是否正在尝试做这样的事情:
对于至少有 2 个订单金额超过 250 美元的客户,将信用额度提高 25%。
编辑
我刚刚注意到您正在使用 Oracle(ORA 消息)。由于您可能要更新所有客户,我相信最有效的方法是使用“可更新连接”或如下合并语句:
The
update
statement doesn't have afrom
clause, like you specified.Are you trying to do something like this:
Increase credit limit by 25% for customers who have at least 2 orders for more than 250 money.
Edit
I just noticed you are using Oracle (the ORA message). Since you are potentially updating all customers, I believe the most performant way would be to use an "updatable join", or a merge statement like below:
或者
or