- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Error sorting error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'main_table.main_table.c
Anyone know how to fix this:
From the Admin we are trying to sort orders by specified dates (i.e. 5/1/19-5/23/19) but are receiving this:
There has been an error processing your request
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'main_table.main_table.created_at' in 'where clause'
Trace:
#0 /home/beehives/public_html/inventory/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/beehives/public_html/inventory/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /home/beehives/public_html/inventory/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#3 /home/beehives/public_html/inventory/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT COUNT(*)...', Array)
#4 /home/beehives/public_html/inventory/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('SELECT COUNT(*)...', Array)
#5 /home/beehives/public_html/inventory/lib/Zend/Db/Adapter/Abstract.php(825): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select), Array)
#6 /home/beehives/public_html/inventory/lib/Varien/Data/Collection/Db.php(225): Zend_Db_Adapter_Abstract->fetchOne(Object(Varien_Db_Select), Array)
#7 /home/beehives/public_html/inventory/lib/Varien/Data/Collection.php(225): Varien_Data_Collection_Db->getSize()
#8 /home/beehives/public_html/inventory/lib/Varien/Data/Collection.php(211): Varien_Data_Collection->getLastPageNumber()
#9 /home/beehives/public_html/inventory/lib/Varien/Data/Collection/Db.php(522): Varien_Data_Collection->getCurPage()
#10 /home/beehives/public_html/inventory/lib/Varien/Data/Collection/Db.php(569): Varien_Data_Collection_Db->_renderLimit()
#11 /home/beehives/public_html/inventory/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php(533): Varien_Data_Collection_Db->load()
#12 /home/beehives/public_html/inventory/app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php(61): Mage_Adminhtml_Block_Widget_Grid->_prepareCollection()
#13 /home/beehives/public_html/inventory/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php(626): Mage_Adminhtml_Block_Sales_Order_Grid->_prepareCollection()
#14 /home/beehives/public_html/inventory/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php(632): Mage_Adminhtml_Block_Widget_Grid->_prepareGrid()
#15 /home/beehives/public_html/inventory/app/code/core/Mage/Core/Block/Abstract.php(866): Mage_Adminhtml_Block_Widget_Grid->_beforeToHtml()
#16 /home/beehives/public_html/inventory/app/code/core/Mage/Core/Block/Abstract.php(586): Mage_Core_Block_Abstract->toHtml()
#17 /home/beehives/public_html/inventory/app/code/core/Mage/Core/Block/Abstract.php(530): Mage_Core_Block_Abstract->_getChildHtml('grid', true)
#18 /home/beehives/public_html/inventory/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Container.php(77): Mage_Core_Block_Abstract->getChildHtml('grid')
#19 /home/beehives/public_html/inventory/app/design/adminhtml/default/default/template/widget/grid/container.phtml(36): Mage_Adminhtml_Block_Widget_Grid_Container->getGridHtml()
#20 /home/beehives/public_html/inventory/app/code/core/Mage/Core/Block/Template.php(243): include('/home/beehives/...')
#21 /home/beehives/public_html/inventory/app/code/core/Mage/Core/Block/Template.php(274): Mage_Core_Block_Template->fetchView('adminhtml/defau...')
#22 /home/beehives/public_html/inventory/app/code/core/Mage/Core/Block/Template.php(288): Mage_Core_Block_Template->renderView()
#23 /home/beehives/public_html/inventory/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml()
#24 /home/beehives/public_html/inventory/app/code/core/Mage/Adminhtml/Block/Widget/Container.php(308): Mage_Adminhtml_Block_Template->_toHtml()
#25 /home/beehives/public_html/inventory/app/code/core/Mage/Core/Block/Abstract.php(867): Mage_Adminhtml_Block_Widget_Container->_toHtml()
#26 /home/beehives/public_html/inventory/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
#27 /home/beehives/public_html/inventory/app/code/core/Mage/Core/Block/Abstract.php(867): Mage_Core_Block_Text_List->_toHtml()
#28 /home/beehives/public_html/inventory/app/code/core/Mage/Core/Block/Abstract.php(586): Mage_Core_Block_Abstract->toHtml()
#29 /home/beehives/public_html/inventory/app/code/core/Mage/Core/Block/Abstract.php(530): Mage_Core_Block_Abstract->_getChildHtml('content', true)
#30 /home/beehives/public_html/inventory/app/design/adminhtml/default/default/template/page.phtml(74): Mage_Core_Block_Abstract->getChildHtml('content')
#31 /home/beehives/public_html/inventory/app/code/core/Mage/Core/Block/Template.php(243): include('/home/beehives/...')
#32 /home/beehives/public_html/inventory/app/code/core/Mage/Core/Block/Template.php(274): Mage_Core_Block_Template->fetchView('adminhtml/defau...')
#33 /home/beehives/public_html/inventory/app/code/core/Mage/Core/Block/Template.php(288): Mage_Core_Block_Template->renderView()
#34 /home/beehives/public_html/inventory/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml()
#35 /home/beehives/public_html/inventory/app/code/core/Mage/Core/Block/Abstract.php(867): Mage_Adminhtml_Block_Template->_toHtml()
#36 /home/beehives/public_html/inventory/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
#37 /home/beehives/public_html/inventory/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
#38 /home/beehives/public_html/inventory/app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php(95): Mage_Core_Controller_Varien_Action->renderLayout()
#39 /home/beehives/public_html/inventory/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Adminhtml_Sales_OrderController->indexAction()
#40 /home/beehives/public_html/inventory/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('index')
#41 /home/beehives/public_html/inventory/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#42 /home/beehives/public_html/inventory/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#43 /home/beehives/public_html/inventory/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#44 /home/beehives/public_html/inventory/index.php(87): Mage::run('', 'store')
#45 {main}
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Error sorting error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'main_table.main_tab
It looks like that there are some issue with your order collection function..
Are you using any custom extension for order grid or any customisations done?
You can check culprit after echo the collection query when try to sort.. then you can check query or execute query manually in the pma or which database tool you are using.
You can echo collection query using:
echo $collection->getSelect();
I hope it will help you!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Error sorting error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'main_table.main_tab
I have this same issue, The error report indicates that there is no overriding of any modules.
`Unknown column 'main_table.main_table.created_at'`
Seems to be adding and extra alias to the query
SELECT DISTINCT COUNT(*) FROM `sales_flat_order_grid` AS `main_table` WHERE (`main_table`.`main_table`.`created_at` >= '2019-10-01 16:00:00' AND `main_table`.`main_table`.`created_at`....
created_at column exist in table
Any ideas?
-------------------------------
Problem identified:
3rd party Module observer adding extra table alias