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?
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: