2015-09-19 106 views
0
 
SQLSTATE[42S22]: Column not found: 1054 Unknown column 
    'SUM((IFNULL(main_table.base_total_invoiced, 0) - 
    IFNULL(main_table.base_tax_invoiced, 0) - 
    IFNULL(main_table.base_shipping_invoiced, 0) - 
    (IFNULL(main_table.base_total_refunded, 0) - IFNULL(ma' in 'field list', 

查詢是:Magento管理儀表板錯誤

SELECT `SUM((IFNULL(main_table.base_total_invoiced, 0) - 
IFNULL(main_table.base_tax_invoiced, 0) - 
IFNULL(main_table.base_shipping_invoiced, 0) - 
(IFNULL(main_table.base_total_refunded, 0) - 
IFNULL(main_table.base_tax_refunded, 0) - 
IFNULL(main_table.base_shipping_refunded, 0))) * 
main_table`.`base_to_global_rate)` AS `lifetime`, 
`AVG((IFNULL(main_table.base_total_invoiced, 0) - 
IFNULL(main_table.base_tax_invoiced, 0) - 
IFNULL(main_table.base_shipping_invoiced, 0) - 
(IFNULL(main_table.base_total_refunded, 0) - 
IFNULL(main_table.base_tax_refunded, 0) - 
IFNULL(main_table.base_shipping_refunded, 0))) * 
main_table`.`base_to_global_rate)` AS `average` FROM 
`sales_flat_order` AS `main_table` WHERE (main_table.status NOT 
IN('canceled')) AND (main_table.state NOT IN('new', 
'pending_payment')) 

當我打開Magento管理面板的儀表板,收到此錯誤。

在此先感謝

+0

您是否正在調試Magento或者這是一個編碼問題? – Enigmativity

回答

0

這是查詢錯誤,它不應該在引號中包含sql函數。嘗試下面的查詢。

SELECT SUM((
IFNULL(main_table.base_total_invoiced, 0) - 
IFNULL(main_table.base_tax_invoiced, 0) - 
IFNULL(main_table.base_shipping_invoiced, 0) - 
IFNULL(main_table.base_total_refunded, 0) - 
IFNULL(main_table.base_tax_refunded, 0) - 
IFNULL(main_table.base_shipping_refunded, 0))) * 
main_table.base_to_global_rate AS `lifetime`, 

AVG((
IFNULL(main_table.base_total_invoiced, 0) - 
IFNULL(main_table.base_tax_invoiced, 0) - 
IFNULL(main_table.base_shipping_invoiced, 0) - 
IFNULL(main_table.base_total_refunded, 0) - 
IFNULL(main_table.base_tax_refunded, 0) - 
IFNULL(main_table.base_shipping_refunded, 0))) * 
main_table.base_to_global_rate AS `average` 
FROM `sales_flat_order` AS `main_table` 
WHERE (main_table.status NOT IN('canceled')) 
AND (main_table.state NOT IN('new', 'pending_payment'))