I need a mySQL query statement and hoping someone can help.
I am working on a WordPress Multisite install and want to 'clone' theme settings. need to copy fields (but not all) from one table into another table, replace existing content and/or add row if they don't exist.
tables have identical structure in the same database, they are:
wp_source_options and wp_target_options
columns are option_name and option_value
if option_name field = "condition1" ("template" for example) is present in targettable copy option_value field from sourcetable and replace targettable option_value field, if not present then add it
would like to update/replace multiple fields with one query. There are five or six fields that would need to be copied (in the theme I have).
It would be acceptable to run two queries - the first to UPDATE and the second to INSERT. or REPLACE? Another issue is that REPLACE might not be available in all phpMyAdmin
the problem seems to be that all suggestions I've found go to replace ALL the fields in a column which wreaks things, column_id won't work because of different id's between tables.
Any mySQL gurus out there?