mardi 20 octobre 2015

Mysql check if record doesnt exits add it

I want add to wp_postmeta meta_key record if this doesn't exists.

I had this query, but from something strange reason it doesn't work anymore. Please help!

 INSERT INTO wp_postmeta (meta_key, meta_value, post_id)
SELECT '_update_date', '', ID FROM wp_posts WHERE wp_posts.post_type='product'
AND NOT EXISTS  (SELECT meta_key FROM wp_postmeta WHERE meta_key = '_update_date' );



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire