爲一個WordPress/Woocommerce網店我創建了一個樞軸視圖中顯示人象的命令:MySQL視圖被顯示出部分列數據
CREATE VIEW vwOrderPivot AS
SELECT
PM.post_id,
GROUP_CONCAT(IF(PM.meta_key = '_billing_first_name',PM.meta_value,NULL)) AS FirstName,
GROUP_CONCAT(IF(PM.meta_key = '_billing_last_name',PM.meta_value,NULL)) AS LastName,
GROUP_CONCAT(IF(PM.meta_key = '_billing_address_1',PM.meta_value,NULL)) AS Address,
GROUP_CONCAT(IF(PM.meta_key = '_billing_postcode',PM.meta_value,NULL)) AS Postcode,
GROUP_CONCAT(IF(PM.meta_key = '_billing_phone',PM.meta_value,NULL)) AS Phone,
GROUP_CONCAT(IF(PM.meta_key = '_order_total',PM.meta_value,NULL)) AS OrderTotal,
GROUP_CONCAT(IF(PM.meta_key = '_pickup_location',PM.meta_value,NULL)) AS PickupLocation,
GROUP_CONCAT(IF(PM.meta_key = '_pickup_time',PM.meta_value,NULL)) AS PickupTime,
GROUP_CONCAT(IF(PM.meta_key = '_order_items',PM.meta_value,NULL)) AS OrderItems
FROM goe_postmeta AS PM
GROUP BY PM.post_id
只有一個小問題。 OrderItems(序列化字段)中的數據僅包含原始字段的一半數據。有什麼方法可以解決這個問題嗎?我沒有任何線索。有人能指引我朝着正確的方向嗎?
親切的問候。