wordpress - Based on the following MYSQL query how can I write an UPDATE statement to update a value? -



wordpress - Based on the following MYSQL query how can I write an UPDATE statement to update a value? -

i'm using next sql query records need wordpress database.

select p.id, p.post_title, m.meta_key, m.meta_value, t.slug wp_posts p inner bring together wp_postmeta m on p.id=m.post_id , m.meta_key='_subscription_sign_up_fee' inner bring together wp_term_relationships tr on p.id = tr.object_id inner bring together wp_term_taxonomy tt on tr.term_taxonomy_id = tt.term_taxonomy_id inner bring together wp_terms t on tt.term_id = t.term_id t.slug = 'bundle'

this pulls right records. issue need increment value of _subscription_sign_up_fee 100.

i've tried following

update wp_postmeta set wp_postmeta.meta_value = wp_postmeta.meta_value + 100 inner bring together wp_postmeta m on wp_posts.id=m.post_id , m.meta_key='_subscription_sign_up_fee' inner bring together wp_term_relationships tr on wp_posts.id = tr.object_id inner bring together wp_term_taxonomy tt on tr.term_taxonomy_id = tt.term_taxonomy_id inner bring together wp_terms t on tt.term_id = t.term_id t.slug = 'bundle'

and error saying 'column 'meta_value' in field list ambiguous ' i'm pretty sure i'm not understanding aliases. can point me in right direction?

the right syntax mysql update joins have set @ end. have problems in you're joining wp_postmeta twice, lost bring together wp_posts.

something should work;

update wp_postmeta m bring together wp_posts on wp_posts.id = m.post_id , m.meta_key = '_subscription_sign_up_fee' bring together wp_term_relationships tr on wp_posts.id = tr.object_id bring together wp_term_taxonomy tt on tr.term_taxonomy_id = tt.term_taxonomy_id bring together wp_terms t on tt.term_id = t.term_id set m.meta_value = m.meta_value + 100 t.slug = 'bundle'

...and remember info before running potentially destructive operations random people on net :)

mysql wordpress

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -