轉換前
SELECT name, order_id FROM wine_s_beaut_order_item WHERE order_id = '4028801c6531f05a01653208c002000f' blog
轉換後it
SELECT order_id,
MAX(CASE types WHEN 'beau_cork' THEN `name` ELSE 0 END) AS 'beau_cork',
MAX(CASE types WHEN 'beau_bottle' THEN `name` ELSE 0 END) AS 'beau_bottle',
MAX(CASE types WHEN 'beau_time' THEN `name` ELSE 0 END) AS 'beau_time'
FROM wine_s_beaut_order_item GROUP BY order_idim