我認爲這是由於您的select * from apef1_virtuemart_orders, apef1_virtuemart_order_items, apef1_virtuemart_order_userinfos
。 virtuemart_order_id
列存在於多個表中。
如果表之間存在名稱衝突,則必須使用別名來確保正確創建視圖。
看到這個查詢:
CREATE VIEW export AS
SELECT
avo.*,
avoi.order_item_sku,
avoi.order_item_name,
avoi.product_quantity,
avoi.product_item_price,
avoi.product_priceWithoutTax,
avoi.product_tax,
avoi.product_basePriceWithTax,
avoi.product_discountedPriceWithoutTax,
avoi.product_final_price,
avoi.product_subtotal_discount,
avoi.product_subtotal_with_tax,
avoi.order_item_currency,
avoi.order_status AS order_status_2,
avoi.product_attribute,
avoi.delivery_date AS delivery_date_2,
avoi.created_on AS created_on_2,
avoi.created_by AS created_by_2,
avoi.modified_on AS modified_on_2,
avoi.modified_by AS modified_by_2,
avoi.locked_on AS locked_on_2,
avoi.locked_by AS locked_by_2,
avou.virtuemart_userinfo_id,
avou.virtuemart_user_id,
avou.address_type,
avou.address_type_name,
avou.name,
avou.company,
avou.title,
avou.last_name,
avou.first_name,
avou.middle_name,
avou.phone_1,
avou.phone_2,
avou.fax,
avou.address_1,
avou.address_2,
avou.city,
avou.virtuemart_state_id,
avou.virtuemart_country_id,
avou.zip,
avou.agreed,
avou.tos,
avou.customer_note,
avou.created_on AS created_on_3,
avou.created_by AS created_by_3,
avou.modified_on AS modified_on_3,
avou.modified_by AS modified_by_3,
avou.locked_on AS locked_on_3,
avou.locked_by AS locked_by_3
FROM
apef1_virtuemart_orders avo,
apef1_virtuemart_order_items avoi,
apef1_virtuemart_order_userinfos avou
WHERE avo.virtuemart_order_id = avoi.virtuemart_order_id
AND avo.virtuemart_order_id = avou.virtuemart_order_id
正如你所看到的,我用別名列created_on
,created_by
等,因爲這些名字是你的3代表相同。請隨意通過調整名稱來適應您的需求來修改查詢。
我現在承擔。非常感謝您的支持。祝你有個美好的一天願上帝保佑你 – carlo
很高興幫助你;-)請你把問題標記爲已解決? –
nope :(我沒有這個feauture – carlo