Search code examples
mysqlphpmyadmin

Edit data in joined tables (mysql) in phpmyadmin


Anybody knows if it possible to edit data in PHPMyAdmin, in table, made by joining two (mysql) tables like this:

SELECT * , pl.name
FROM product p
JOIN product_language pl ON p.product_id = pl.product_id
AND pl.lang_id =4
ORDER BY p.product_id
LIMIT 0 , 30

If I select only one table, I can edit data in it no problem, but when I join two, I cannot. Would appreciate any help. Thanks!


Solution

  • Edit: see answer by @michael-sqlbot for how to do this with updatable views.

    Original post: You can't edit joined tables, because there's no way for it to know what you're actually editing. For instance, you could have done "select concat(pl.id,'_',p.product_id)". Since phpmyadmin has no way of predicting what you might be showing, it can't let you edit it; it has no way to map that back to a primary key to know how to modify the original data.