oracle - beginner sql question pt.2 error ora-00933 SQL command not properly ended -
i have update tables assignment in dbms. can't figure out why error.
update customers set creditlimit = creditlimit * 1.25 from(select * orders amount > 250 having count(*) >= 2);
any ideas?
the update
statement doesn't have from
clause, specified.
trying this: increase credit limit 25% customers have @ least 2 orders more 250 money.
update customers set creditlimit = creditlimit * 1.25 (select count(*) orders amount > 250 , orders.customer_id = customers.customer_id)) >= 2;
edit
noticed using oracle (the ora message). since potentially updating customers, believe performant way use "updatable join", or merge statement below:
merge customers using (select customer_id orders o amount > 250 group customer_id having count(*) >= 2 ) orders on(customers.customer_id = orders.customer_id) when matched update set customers.creditlimit = customers.creditlimit * 1.25;
Comments
Post a Comment