Skip to content Skip to sidebar Skip to footer

How To Update/ Make A View Updatable In Mysql

I have created a view via: CREATE VIEW product_prices AS SELECT Name, Price FROM Products; And I need to update it so prices under £10 are made 10% bigger apart from ones that ar

Solution 1:

Use a join instead of <>:

UPDATE product_prices pp LEFTJOIN
       Products p
       ON p.name = pp.anme and p.Category_ID =3SET pp.Price = pp.Price *1.1WHERE p.Name ISNULLAND pp.Price <10;

The issue is the operation on the table being updated, not the view definition.

Post a Comment for "How To Update/ Make A View Updatable In Mysql"