I'm working in a database with MySQL thought phpMyAdmin, and it's important to know that my knowledge on MySQL is pretty limited.
I have two tables in my database. I need to take the img_id
column values in the second table (wp_posts_thumbs), find the matching pair in the first table (wp_posts), take the corresponding value in the ID
column in the first table, and insert it in the post_parent
column in the second table.
This is what the first table (wp_posts) looks like:
+------+-------------------------+
| ID | img_id |
+------+-------------------------+
| 1 | W048zewxemq1tw0810aiec |
| 2 | W0481l2lv4npdczok5mmucl |
| 3 | W0481j9w7fg80b8gkiida85 |
+------+-------------------------+
This is what the second table (wp_posts_thumbs) looks like:
+------+-------------------------+-------------+
| ID | img_id | post_parent |
+------+-------------------------+-------------+
| 101 | W048zewxemq1tw0810aiec | 0 |
| 102 | W0481l2lv4npdczok5mmucl | 0 |
| 103 | W0481j9w7fg80b8gkiida85 | 0 |
+------+-------------------------+-------------+
Thanks in advance, guys :)