[thelist] mysql update field based upon another

Bob Meetin bobm at dottedi.biz
Fri Jul 25 09:38:40 CDT 2014


This seems like it should be fairly simple, but anyhow. I am trying to synchronize the params field of a category, all the items in that category, based upon the params field of an item that is the model. This does not work, is not valid mysql:

update p3h0i_k2_items set params = (select params from p3h0i_k2_items where id = 300) where id = 278;

The params field is a complex field of parameters.  Item ID 300 is the role model for the field. I want to first test it by updating the params of a single item, above, then if it works, go for the category, something like:

update p3h0i_k2_items set params = (select params from p3h0i_k2_items where id = 300) where catid = 100;

What is the correct mysql syntax to make this work?

-Bob


More information about the thelist mailing list