I started getting this error suddenly and I checked and the table does exist. I'm not sure how to start fixing this issue. I have attached a picture below:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento_e.catalog_category_flat_store_1' doesn't exist, query was: SELECT
main_table
.entity_id
, main_table.name
, main_table.path
,main_table
.is_active
,main_table
.is_anchor
,url_rewrite
.request_path
FROMcatalog_category_flat_store_1
ASmain_table
LEFT JOINurl_rewrite
ON url_rewrite.entity_id = main_table.entity_id AND url_rewrite.is_autogenerated = 1 AND url_rewrite.store_id = 1 AND url_rewrite.entity_type = 'category' WHERE (main_table.is_active = 1) AND (main_table.path like '1/2/15/%') AND (level
<= 3) ORDER BYmain_table
.position
ASC
Best Answer
In order to resolve this issue,you need to create flat table
catalog_category_flat_store_1
.disable magento Catalog Flat for Category from
Admin>Stores>Configuration>Catalog>Catalog>StoreFront>Use Flat Catalog Category
make it NOThen Flush magento Cache by
php bin/magento cache:flush
Then you should drop table
catalog_category_flat_store_1
, if it is exists in db bydrop table catalog_category_flat_store_1
Next enable Catalog Flat for Category by
Use Flat Catalog Category
make it yesFinal,you need to indexing from magento cli :
php bin/magento indexer:reindex