I have two tables (in Woo Commerce in WordPress) where I would like to merge the results
A simplified version of the tables are:
ID | Product title |
---|---|
1 | Gadget |
2 | Gizmo |
And
Meta_ID | Product_ID | Meta_key | Meta_value |
---|---|---|---|
1 | 1 | stock | 20 |
2 | 1 | download | No |
3 | 2 | stock | 12 |
4 | 2 | download | yes |
'ID' in the first table corresponds to the foreign key of 'Product_ID' in the second table.
Is there any way I can use a select query to merge these to produce the following result:
ID | Product_title | stock | download |
---|---|---|---|
1 | Gadget | 20 | No |
2 | Gizmo | 12 | Yes |