0
votes

I'm trying write an update statement that changes the passwords of customers who placed more than one order to excellent, which contains all lowercase characters:

UPDATE customers_mgs
SET password = 'excellent'
WHERE customer_id = SELECT customer_id FROM customers_mgs WHERE count(>1 group by customer_id)

But I keep getting this error message: Error report - SQL Error: ORA-00936: missing expression 00936. 00000 - "missing expression"

1
It is really strange that you would store the password in a table called customer_msgs -- and also that you would store a password in clear text. - Gordon Linoff

1 Answers

1
votes

You need parentheses around a subquery. Presumably, you also want IN rather than =:

UPDATE customers_mgs
    SET password = 'excellent'
    WHERE customer_id IN (SELECT customer_id
                          FROM customers_mgs 
                          GROUP BY customer_id
                          HAVING COUNT(*) > 1
                         );