The goal is to migrate the data related to a product definition stored in a WordPress table (in this case, credit cards).

Here is an example of the data I want to migrate:

SELECT meta_key, meta_value FROM wp_postmeta WHERE post_id = 366;
+-----------------+------------------------------------+
| meta_key        | meta_value                         |
+-----------------+------------------------------------+
| Name            | Santos Futebol Clube International |
| Issuer          | Bradesco Banco                     |
| Issuer_Subtype  | Bradesco                           |
+-----------------+------------------------------------+

There are many more fields, but I show three of them just as an example.
There is also many product items (each post represents an item).

I want to migrate these data into a table with the following structure:

DESCRIBE card;
+-----------------------+--------------+------+-----+---------+----------------+
| Field                 | Type         | Null | Key | Default | Extra          |
+-----------------------+--------------+------+-----+---------+----------------+
| id                    | int(11)      | NO   | PRI | NULL    | auto_increment |
| name                  | varchar(255) | YES  |     | NULL    |                | 
| issuer                | varchar(255) | YES  |     | NULL    |                |
| issuer_subtype        | varchar(255) | YES  |     | NULL    |                |
+-----------------------+--------------+------+-----+---------+----------------+

Since the data in the WordPress table representing each item is located in different rows, I’m having problems trying to grasp my head around how to make a query that can achive this.

Any suggestions?

Read more here: Create new table with data from WordPress wp_postmeta table


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , ,

Wordpress related questions and answers: