Yes, you can update views in MySQL! A lot of people seem to be under the impression that you are unable to, but this simply isn’t the case. There are a lot of restrictive rules, which can be found in the MySQL manual, but as a rule of thumb, you can update them, but only one table.
For example, lets say you have a view which links table A and table B.
You can run an update on this view, but only if you are only updating the columns from one table. So you could run a query that updates a number of columns from table A, or you could run a query which updates columns from table B – but you can’t run a query which updated columns in both table A and table B.
If you need to accomplish this, you need to use a join instead.
Don't have time to check my blog? Get a weekly email with all the new posts. This is my personal blog, so obviously it is 100% spam free.
Tags: join, mysql, update, views
This entry was posted on Thursday, January 5th, 2012 at 10:59 am and is filed under Life, Tech. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.