0

So I have two MySQL tables

"users" table includes id, listing_name and location

"wp_postmeta" table includes id, meta_key and meta_value

I want to insert meta_value from "wp_postmeta" into the location column in the "users" table, where both ID's match and meta_key's value is "address"

Example with the following values.

users TABLE
-----------
id: 1
listing_name: my listing
location: NULL

id: 2
listing_name: my listing 2
location: NULL

wp_postmeta TABLE
-----------
id: 1
meta_key: address
location: 12 Coding Avenue

id: 2
meta_key:address
location: 20 Python Drive

So afterwards my tables should look like:

users TABLE
-----------
id: 1
listing_name: my listing
location: 12 Coding Avenue

id: 2
listing_name: my listing 2
location: 20 Python Drive

wp_postmeta TABLE
-----------
id: 1
meta_key: address
location: 12 Coding Avenue

id: 2
meta_key:address
location: 20 Python Drive

I hope this is enough info.

nulled
  • 383
  • 1
  • 5
  • 20

0 Answers0