SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'store_id' in where clause is ambiguousIntegrity constraint violation: 1052 Column 'increment_id' in where clause is ambiguousAdmin Order Grid overridden with custom fields cannot be filteredColumn 'store_id' in where clause is ambiguous when adding custom order attribute to grid and changing storeAfter join the customer name with custom module, i can't filter the grid by customer nameAn Error when trying to open an order in the AdminHow to add Email address in sales orders admin grid?Magento 2:SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'entity_id' in where clause is ambiguousHow to write inner join query in collection method (magento2)?Filter a custom attribute in Sales Order GridMagento 1: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'status' in where clause is ambiguous

How to setup a teletype to a unix shell

Why doesn't the Falcon-9 first stage use three legs to land?

Shouldn't the "credit score" prevent Americans from going deeper and deeper into personal debt?

Can we save the word "unique"?

Don't understand MOSFET as amplifier

Was this pillow joke on Friends intentional or a mistake?

Ask for a paid taxi in order to arrive as early as possible for an interview within the city

What happens when I copy a legendary creature with Rite of Replication?

Can you be convicted for being a murderer twice?

Can you grapple/shove with the Hunter Ranger's Whirlwind Attack?

In an emergency, how do I find and share my position?

How can I run SQL Server Vulnerability Assessment from a SQL Job?

Taking out number of subarrays from an array which contains all the distinct elements of that array

Why were movies shot on film shot at 24 frames per second?

Do we need to assume underlying returns are normal in BSM model, given Central Limit Theorem?

How to persuade recruiters to send me the Job Description?

Is it safe to remove the bottom chords of a series of garage roof trusses?

Is it insecure to have an ansible user with passwordless sudo?

Have only girls been born for a long time in this village?

Can a group have a cyclical derived series?

What does it mean to have a subnet mask /32?

How can I support the recycling, but not the new production of aluminum?

Metal that glows when near pieces of itself

Can my boyfriend, who lives in the UK and has a Polish passport, visit me in the USA?



SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'store_id' in where clause is ambiguous


Integrity constraint violation: 1052 Column 'increment_id' in where clause is ambiguousAdmin Order Grid overridden with custom fields cannot be filteredColumn 'store_id' in where clause is ambiguous when adding custom order attribute to grid and changing storeAfter join the customer name with custom module, i can't filter the grid by customer nameAn Error when trying to open an order in the AdminHow to add Email address in sales orders admin grid?Magento 2:SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'entity_id' in where clause is ambiguousHow to write inner join query in collection method (magento2)?Filter a custom attribute in Sales Order GridMagento 1: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'status' in where clause is ambiguous






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















After searching around I still haven't found a solution so I thought I would post it here. Any help would be greatly appreciated.



When I go to filter one of the columns it redirects me to dashboard then when I click on sales -> orders it loads the following error:



SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'store_id' in where clause is ambiguous, query was: SELECT COUNT(*) FROM mg_sales_flat_order_grid AS main_table
INNER JOIN mg_sales_flat_order AS order ON order.entity_id=main_table.entity_id WHERE (store_id = '1')










share|improve this question


























  • Which version of Magento? Any custom columns in grid has been added?

    – rafal-kos
    Aug 11 '16 at 14:45











  • 1.9.2.4 and not that I'm aware of I didn't build the site. Columns that exist are: Order, Purchased From (Store), Purchased On, Bill to Name, Deliver to Name, G.T. (Base), G.T. (Purchased), Voucher Code, Billing Postcode, Delivery Postcode, Status

    – Hayden
    Aug 11 '16 at 14:52

















0















After searching around I still haven't found a solution so I thought I would post it here. Any help would be greatly appreciated.



When I go to filter one of the columns it redirects me to dashboard then when I click on sales -> orders it loads the following error:



SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'store_id' in where clause is ambiguous, query was: SELECT COUNT(*) FROM mg_sales_flat_order_grid AS main_table
INNER JOIN mg_sales_flat_order AS order ON order.entity_id=main_table.entity_id WHERE (store_id = '1')










share|improve this question


























  • Which version of Magento? Any custom columns in grid has been added?

    – rafal-kos
    Aug 11 '16 at 14:45











  • 1.9.2.4 and not that I'm aware of I didn't build the site. Columns that exist are: Order, Purchased From (Store), Purchased On, Bill to Name, Deliver to Name, G.T. (Base), G.T. (Purchased), Voucher Code, Billing Postcode, Delivery Postcode, Status

    – Hayden
    Aug 11 '16 at 14:52













0












0








0








After searching around I still haven't found a solution so I thought I would post it here. Any help would be greatly appreciated.



When I go to filter one of the columns it redirects me to dashboard then when I click on sales -> orders it loads the following error:



SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'store_id' in where clause is ambiguous, query was: SELECT COUNT(*) FROM mg_sales_flat_order_grid AS main_table
INNER JOIN mg_sales_flat_order AS order ON order.entity_id=main_table.entity_id WHERE (store_id = '1')










share|improve this question
















After searching around I still haven't found a solution so I thought I would post it here. Any help would be greatly appreciated.



When I go to filter one of the columns it redirects me to dashboard then when I click on sales -> orders it loads the following error:



SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'store_id' in where clause is ambiguous, query was: SELECT COUNT(*) FROM mg_sales_flat_order_grid AS main_table
INNER JOIN mg_sales_flat_order AS order ON order.entity_id=main_table.entity_id WHERE (store_id = '1')







database error grid sales-order sales






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 11 '16 at 15:41









Amarendra Kumar

2031 silver badge6 bronze badges




2031 silver badge6 bronze badges










asked Aug 11 '16 at 14:42









HaydenHayden

113 bronze badges




113 bronze badges















  • Which version of Magento? Any custom columns in grid has been added?

    – rafal-kos
    Aug 11 '16 at 14:45











  • 1.9.2.4 and not that I'm aware of I didn't build the site. Columns that exist are: Order, Purchased From (Store), Purchased On, Bill to Name, Deliver to Name, G.T. (Base), G.T. (Purchased), Voucher Code, Billing Postcode, Delivery Postcode, Status

    – Hayden
    Aug 11 '16 at 14:52

















  • Which version of Magento? Any custom columns in grid has been added?

    – rafal-kos
    Aug 11 '16 at 14:45











  • 1.9.2.4 and not that I'm aware of I didn't build the site. Columns that exist are: Order, Purchased From (Store), Purchased On, Bill to Name, Deliver to Name, G.T. (Base), G.T. (Purchased), Voucher Code, Billing Postcode, Delivery Postcode, Status

    – Hayden
    Aug 11 '16 at 14:52
















Which version of Magento? Any custom columns in grid has been added?

– rafal-kos
Aug 11 '16 at 14:45





Which version of Magento? Any custom columns in grid has been added?

– rafal-kos
Aug 11 '16 at 14:45













1.9.2.4 and not that I'm aware of I didn't build the site. Columns that exist are: Order, Purchased From (Store), Purchased On, Bill to Name, Deliver to Name, G.T. (Base), G.T. (Purchased), Voucher Code, Billing Postcode, Delivery Postcode, Status

– Hayden
Aug 11 '16 at 14:52





1.9.2.4 and not that I'm aware of I didn't build the site. Columns that exist are: Order, Purchased From (Store), Purchased On, Bill to Name, Deliver to Name, G.T. (Base), G.T. (Purchased), Voucher Code, Billing Postcode, Delivery Postcode, Status

– Hayden
Aug 11 '16 at 14:52










1 Answer
1






active

oldest

votes


















0














Try to use below code just before the $this->setCollection($collection);



$collection->addFilterToMap('store_id', 'main_table.store_id');



Another solution used in some default Magento modules is



if (!Mage::app()->isSingleStoreMode()) 
$this->addColumn('store_id', array(
'header' => Mage::helper('sales')->__('Purchased From (Store)'),
'index' => 'store_id',
'type' => 'store',
'store_view'=> true,
'display_deleted' => true,
'filter_index' => 'main_table.store_id',
));






share|improve this answer

























  • I have tried doing both of those fixes but nothing works. I have even tried applying the same filter_index but for every column and also addfiltertomap for all of the columns. Just to confirm I have to edit the /app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php file? Another thing I have noticed is that the voucher code column is there but it doesn't exist in the code. I'm starting to think now that it might be an extension trying to edit the grid view. Also is there anything I need to do after I have saved changes to the code, I have been flushing the cache.

    – Hayden
    Aug 11 '16 at 15:38












  • See in code for this kind of string Mage_Adminhtml_Block_Sales_Order_Grid.php to see if something is not overriding the class. You should also place changed file in app/code/local to avoid problems with magento updated in future. After change there is no need to do any cache cleaning as I know.

    – rafal-kos
    Aug 11 '16 at 20:15











  • I think we are on to something here. I have just checked the development site and there is no includes/src folder where Mage_Adminhtml_Block_Sales_Order_Grid.php is. On the main site there is with lots of files in there. This could be the fix, I will update this post if it works by adding it in.

    – Hayden
    Aug 12 '16 at 7:53











  • Ok so I added the file into the includes/src/ folder and edited it with code above but still no fix. I am now slightly concerned why there is no src folder here on the dev site but there is on the main site. Thank you for all your help so far. It would be a huge relief to resolve this one.

    – Hayden
    Aug 12 '16 at 8:39













Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f131073%2fsqlstate23000-integrity-constraint-violation-1052-column-store-id-in-where%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Try to use below code just before the $this->setCollection($collection);



$collection->addFilterToMap('store_id', 'main_table.store_id');



Another solution used in some default Magento modules is



if (!Mage::app()->isSingleStoreMode()) 
$this->addColumn('store_id', array(
'header' => Mage::helper('sales')->__('Purchased From (Store)'),
'index' => 'store_id',
'type' => 'store',
'store_view'=> true,
'display_deleted' => true,
'filter_index' => 'main_table.store_id',
));






share|improve this answer

























  • I have tried doing both of those fixes but nothing works. I have even tried applying the same filter_index but for every column and also addfiltertomap for all of the columns. Just to confirm I have to edit the /app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php file? Another thing I have noticed is that the voucher code column is there but it doesn't exist in the code. I'm starting to think now that it might be an extension trying to edit the grid view. Also is there anything I need to do after I have saved changes to the code, I have been flushing the cache.

    – Hayden
    Aug 11 '16 at 15:38












  • See in code for this kind of string Mage_Adminhtml_Block_Sales_Order_Grid.php to see if something is not overriding the class. You should also place changed file in app/code/local to avoid problems with magento updated in future. After change there is no need to do any cache cleaning as I know.

    – rafal-kos
    Aug 11 '16 at 20:15











  • I think we are on to something here. I have just checked the development site and there is no includes/src folder where Mage_Adminhtml_Block_Sales_Order_Grid.php is. On the main site there is with lots of files in there. This could be the fix, I will update this post if it works by adding it in.

    – Hayden
    Aug 12 '16 at 7:53











  • Ok so I added the file into the includes/src/ folder and edited it with code above but still no fix. I am now slightly concerned why there is no src folder here on the dev site but there is on the main site. Thank you for all your help so far. It would be a huge relief to resolve this one.

    – Hayden
    Aug 12 '16 at 8:39















0














Try to use below code just before the $this->setCollection($collection);



$collection->addFilterToMap('store_id', 'main_table.store_id');



Another solution used in some default Magento modules is



if (!Mage::app()->isSingleStoreMode()) 
$this->addColumn('store_id', array(
'header' => Mage::helper('sales')->__('Purchased From (Store)'),
'index' => 'store_id',
'type' => 'store',
'store_view'=> true,
'display_deleted' => true,
'filter_index' => 'main_table.store_id',
));






share|improve this answer

























  • I have tried doing both of those fixes but nothing works. I have even tried applying the same filter_index but for every column and also addfiltertomap for all of the columns. Just to confirm I have to edit the /app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php file? Another thing I have noticed is that the voucher code column is there but it doesn't exist in the code. I'm starting to think now that it might be an extension trying to edit the grid view. Also is there anything I need to do after I have saved changes to the code, I have been flushing the cache.

    – Hayden
    Aug 11 '16 at 15:38












  • See in code for this kind of string Mage_Adminhtml_Block_Sales_Order_Grid.php to see if something is not overriding the class. You should also place changed file in app/code/local to avoid problems with magento updated in future. After change there is no need to do any cache cleaning as I know.

    – rafal-kos
    Aug 11 '16 at 20:15











  • I think we are on to something here. I have just checked the development site and there is no includes/src folder where Mage_Adminhtml_Block_Sales_Order_Grid.php is. On the main site there is with lots of files in there. This could be the fix, I will update this post if it works by adding it in.

    – Hayden
    Aug 12 '16 at 7:53











  • Ok so I added the file into the includes/src/ folder and edited it with code above but still no fix. I am now slightly concerned why there is no src folder here on the dev site but there is on the main site. Thank you for all your help so far. It would be a huge relief to resolve this one.

    – Hayden
    Aug 12 '16 at 8:39













0












0








0







Try to use below code just before the $this->setCollection($collection);



$collection->addFilterToMap('store_id', 'main_table.store_id');



Another solution used in some default Magento modules is



if (!Mage::app()->isSingleStoreMode()) 
$this->addColumn('store_id', array(
'header' => Mage::helper('sales')->__('Purchased From (Store)'),
'index' => 'store_id',
'type' => 'store',
'store_view'=> true,
'display_deleted' => true,
'filter_index' => 'main_table.store_id',
));






share|improve this answer













Try to use below code just before the $this->setCollection($collection);



$collection->addFilterToMap('store_id', 'main_table.store_id');



Another solution used in some default Magento modules is



if (!Mage::app()->isSingleStoreMode()) 
$this->addColumn('store_id', array(
'header' => Mage::helper('sales')->__('Purchased From (Store)'),
'index' => 'store_id',
'type' => 'store',
'store_view'=> true,
'display_deleted' => true,
'filter_index' => 'main_table.store_id',
));







share|improve this answer












share|improve this answer



share|improve this answer










answered Aug 11 '16 at 14:59









rafal-kosrafal-kos

5872 silver badges15 bronze badges




5872 silver badges15 bronze badges















  • I have tried doing both of those fixes but nothing works. I have even tried applying the same filter_index but for every column and also addfiltertomap for all of the columns. Just to confirm I have to edit the /app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php file? Another thing I have noticed is that the voucher code column is there but it doesn't exist in the code. I'm starting to think now that it might be an extension trying to edit the grid view. Also is there anything I need to do after I have saved changes to the code, I have been flushing the cache.

    – Hayden
    Aug 11 '16 at 15:38












  • See in code for this kind of string Mage_Adminhtml_Block_Sales_Order_Grid.php to see if something is not overriding the class. You should also place changed file in app/code/local to avoid problems with magento updated in future. After change there is no need to do any cache cleaning as I know.

    – rafal-kos
    Aug 11 '16 at 20:15











  • I think we are on to something here. I have just checked the development site and there is no includes/src folder where Mage_Adminhtml_Block_Sales_Order_Grid.php is. On the main site there is with lots of files in there. This could be the fix, I will update this post if it works by adding it in.

    – Hayden
    Aug 12 '16 at 7:53











  • Ok so I added the file into the includes/src/ folder and edited it with code above but still no fix. I am now slightly concerned why there is no src folder here on the dev site but there is on the main site. Thank you for all your help so far. It would be a huge relief to resolve this one.

    – Hayden
    Aug 12 '16 at 8:39

















  • I have tried doing both of those fixes but nothing works. I have even tried applying the same filter_index but for every column and also addfiltertomap for all of the columns. Just to confirm I have to edit the /app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php file? Another thing I have noticed is that the voucher code column is there but it doesn't exist in the code. I'm starting to think now that it might be an extension trying to edit the grid view. Also is there anything I need to do after I have saved changes to the code, I have been flushing the cache.

    – Hayden
    Aug 11 '16 at 15:38












  • See in code for this kind of string Mage_Adminhtml_Block_Sales_Order_Grid.php to see if something is not overriding the class. You should also place changed file in app/code/local to avoid problems with magento updated in future. After change there is no need to do any cache cleaning as I know.

    – rafal-kos
    Aug 11 '16 at 20:15











  • I think we are on to something here. I have just checked the development site and there is no includes/src folder where Mage_Adminhtml_Block_Sales_Order_Grid.php is. On the main site there is with lots of files in there. This could be the fix, I will update this post if it works by adding it in.

    – Hayden
    Aug 12 '16 at 7:53











  • Ok so I added the file into the includes/src/ folder and edited it with code above but still no fix. I am now slightly concerned why there is no src folder here on the dev site but there is on the main site. Thank you for all your help so far. It would be a huge relief to resolve this one.

    – Hayden
    Aug 12 '16 at 8:39
















I have tried doing both of those fixes but nothing works. I have even tried applying the same filter_index but for every column and also addfiltertomap for all of the columns. Just to confirm I have to edit the /app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php file? Another thing I have noticed is that the voucher code column is there but it doesn't exist in the code. I'm starting to think now that it might be an extension trying to edit the grid view. Also is there anything I need to do after I have saved changes to the code, I have been flushing the cache.

– Hayden
Aug 11 '16 at 15:38






I have tried doing both of those fixes but nothing works. I have even tried applying the same filter_index but for every column and also addfiltertomap for all of the columns. Just to confirm I have to edit the /app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php file? Another thing I have noticed is that the voucher code column is there but it doesn't exist in the code. I'm starting to think now that it might be an extension trying to edit the grid view. Also is there anything I need to do after I have saved changes to the code, I have been flushing the cache.

– Hayden
Aug 11 '16 at 15:38














See in code for this kind of string Mage_Adminhtml_Block_Sales_Order_Grid.php to see if something is not overriding the class. You should also place changed file in app/code/local to avoid problems with magento updated in future. After change there is no need to do any cache cleaning as I know.

– rafal-kos
Aug 11 '16 at 20:15





See in code for this kind of string Mage_Adminhtml_Block_Sales_Order_Grid.php to see if something is not overriding the class. You should also place changed file in app/code/local to avoid problems with magento updated in future. After change there is no need to do any cache cleaning as I know.

– rafal-kos
Aug 11 '16 at 20:15













I think we are on to something here. I have just checked the development site and there is no includes/src folder where Mage_Adminhtml_Block_Sales_Order_Grid.php is. On the main site there is with lots of files in there. This could be the fix, I will update this post if it works by adding it in.

– Hayden
Aug 12 '16 at 7:53





I think we are on to something here. I have just checked the development site and there is no includes/src folder where Mage_Adminhtml_Block_Sales_Order_Grid.php is. On the main site there is with lots of files in there. This could be the fix, I will update this post if it works by adding it in.

– Hayden
Aug 12 '16 at 7:53













Ok so I added the file into the includes/src/ folder and edited it with code above but still no fix. I am now slightly concerned why there is no src folder here on the dev site but there is on the main site. Thank you for all your help so far. It would be a huge relief to resolve this one.

– Hayden
Aug 12 '16 at 8:39





Ok so I added the file into the includes/src/ folder and edited it with code above but still no fix. I am now slightly concerned why there is no src folder here on the dev site but there is on the main site. Thank you for all your help so far. It would be a huge relief to resolve this one.

– Hayden
Aug 12 '16 at 8:39

















draft saved

draft discarded
















































Thanks for contributing an answer to Magento Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f131073%2fsqlstate23000-integrity-constraint-violation-1052-column-store-id-in-where%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form