我有一个样本数据
product (ID, name)
1 | 'iPhone'
2 | 'iPad'
3 | 'iWatch'
product_meta (ID, product_id, meta_key, meta_value)
1 1 image iPhone.png
2 2 view 123
并使用查询:
SELECT p.*, m.*
FROM product AS p
LEFT JOIN product_meta AS m ON m.product_id = p.ID
WHERE p.ID = 1
GROUP BY p.ID
如何获得结果的所有价值是
product(ID, name, image, view) => 1 | iPhone | iPhone.png | 123