Question: Using MySQL Workbench. Write an UPDATE statement that modifies the Invoices table. Change the terms_id column to 2 for each invoice that's for a vendor

Using MySQL Workbench.

Write an UPDATE statement that modifies the Invoices table. Change the terms_id column to 2 for each invoice that's for a vendor with a default_terms_id of 2.

What I have tried and their errors:

UPDATE invoices SET terms_id = 2 WHERE vendor_id in (SELECT vendor_id FROM vendors WHERE default_terms_id = 2);

ERROR MESSAGE: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column.

UPDATE invoices SET terms_id = 2 WHERE vendor_id = (SELECT vendor_id FROM vendors WHERE default_terms_id = 2);

ERROR MESSAGE: Subquery returns more than one row

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!