0

I have a table menu_item with id, and min price. I have another table menu_item_variant with menu_item_id, variant_value_id and price1. I want to set menu_item.min_price = menu_item_variant.price1 when variant_value_id=1550. I am using the following command but it's giving me an error. I can't see what is wrong with it. Please help

update menu_item set menu_item.min_price = menu_item_variant.price1 
from menu_item join menu_item_variant 
on menu_item.id = menu_item_variant.menu_item_id 
where variant_value_id = 1550;

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from menu_item join menu_item_variant on menu_item.id = menu_item_variant.menu_i' at line 1

1 Answer 1

1

The proper syntax in MySQL does not use from:

update menu_item join
       menu_item_variant
       on menu_item.id = menu_item_variant.menu_item_id
    set menu_item.min_price = menu_item_variant.price1
where variant_value_id = 1550;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.