我想将具有不同值的两个相等的列名(meta_value)合并为一个行结果而不是两个。
SELECT t1.ID, t1.post_content AS product, t2.meta_value AS price
FROM wp_posts AS t1
INNER JOIN wp_postmeta AS t2 ON ( t1.id = t2.post_id )
WHERE t1.post_type = 'product'
LIMIT 0 , 30
结果是
ID product price
1973 product1 12.35
1973 product1 12.10
我希望它看起来像这样
ID product price sell
1973 product1 12.35 12.10
price 的 meta_key 是 _price,sell 的 meta_key 是 _sell