Database Error

Hello, I am getting this error, in database errors log:

Bază de date (eroare)
Eroare: Unknown column 'sales_discount' in 'order clause' (1054)
ÃŽntrebare: SELECT SQL_CALC_FOUND_ROWS products.product_id, IF(shared_descr.product_id IS NOT NULL, shared_descr.product, descr1.product) as product, SUM(cscart_product_sales.amount) as sales_amount FROM cscart_products as products LEFT JOIN cscart_product_descriptions as descr1 ON descr1.product_id = products.product_id AND descr1.lang_code = 'ro' LEFT JOIN cscart_product_prices as prices ON prices.product_id = products.product_id AND prices.lower_limit = 1 INNER JOIN cscart_products_categories as products_categories ON products_categories.product_id = products.product_id INNER JOIN cscart_categories ON cscart_categories.category_id = products_categories.category_id AND (cscart_categories.usergroup_ids = '' OR FIND_IN_SET(0, cscart_categories.usergroup_ids) OR FIND_IN_SET(1, cscart_categories.usergroup_ids)) AND cscart_categories.status IN ('A', 'H') LEFT JOIN cscart_ult_product_descriptions shared_descr ON shared_descr.product_id = products.product_id AND shared_descr.company_id = 1 AND shared_descr.lang_code = 'ro' INNER JOIN cscart_product_sales ON cscart_product_sales.product_id = products.product_id AND cscart_product_sales.category_id = products_categories.category_id WHERE 1 AND cscart_categories.company_id = 1 AND (products.usergroup_ids = '' OR FIND_IN_SET(0, products.usergroup_ids) OR FIND_IN_SET(1, products.usergroup_ids)) AND products.status IN ('A') AND prices.usergroup_id IN (0, 0, 1) AND cscart_product_sales.amount >= 1 GROUP BY cscart_product_sales.product_id ORDER BY sales_discount asc, product_id ASC LIMIT 120, 24

Istoric››

index.php (fn_dispatch): 25
app/functions/fn.control.php (fn_run_controller): 455
app/functions/fn.control.php (include): 699
app/addons/bestsellers/controllers/frontend/products.post.php (fn_get_products): 66
app/functions/fn.catalog.php ({closure}): 6673
app/functions/fn.catalog.php (db_get_array): 6594
app/functions/fn.database.php (call_user_func_array): 28
app/Tygh/Database/Connection.php (getArray): 234
app/Tygh/Database/Connection.php (query): 454

Any idea what is wrong?

The sales_discount field is missing but I do not see where it is used in the database.

I have some other errors, the error appear once a day, not often:

Bază de date (eroare)
Eroare: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'asc, product_id ASC LIMIT 0, 24' at line 1 (1064)
ÃŽntrebare: SELECT SQL_CALC_FOUND_ROWS products.product_id, IF(inventory.product_code LIKE '%foto kodak glossy%', inventory.combination, null) AS combination, IF(shared_descr.product_id IS NOT NULL, shared_descr.product, descr1.product) as product FROM cscart_products as products LEFT JOIN cscart_product_options_inventory as inventory ON inventory.product_id = products.product_id LEFT JOIN cscart_product_descriptions as descr1 ON descr1.product_id = products.product_id AND descr1.lang_code = 'ro' LEFT JOIN cscart_product_prices as prices ON prices.product_id = products.product_id AND prices.lower_limit = 1 INNER JOIN cscart_products_categories as products_categories ON products_categories.product_id = products.product_id INNER JOIN cscart_categories ON cscart_categories.category_id = products_categories.category_id AND (cscart_categories.usergroup_ids = '' OR FIND_IN_SET(0, cscart_categories.usergroup_ids) OR FIND_IN_SET(1, cscart_categories.usergroup_ids)) AND cscart_categories.status IN ('A', 'H') LEFT JOIN cscart_ult_product_descriptions shared_descr ON shared_descr.product_id = products.product_id AND shared_descr.company_id = 1 AND shared_descr.lang_code = 'ro' WHERE 1 AND (((descr1.search_words LIKE '%foto kodak glossy%') OR descr1.product LIKE '%foto kodak glossy%' OR descr1.short_description LIKE '%foto kodak glossy%' OR descr1.short_description LIKE '%foto kodak glossy%' OR descr1.full_description LIKE '%foto kodak glossy%' OR descr1.full_description LIKE '%foto kodak glossy%' OR (descr1.meta_keywords LIKE '%foto kodak glossy%' OR descr1.meta_description LIKE '%foto kodak glossy%') OR inventory.product_code LIKE '%foto kodak glossy%' OR products.product_code LIKE '%foto kodak glossy%')) AND cscart_categories.company_id = 1 AND (products.usergroup_ids = '' OR FIND_IN_SET(0, products.usergroup_ids) OR FIND_IN_SET(1, products.usergroup_ids)) AND products.status IN ('A') AND prices.usergroup_id IN (0, 0, 1) GROUP BY products.product_id ORDER BY asc, product_id ASC LIMIT 0, 24

Istoric››

index.php (fn_dispatch): 25
app/functions/fn.control.php (fn_run_controller): 455
app/functions/fn.control.php (include): 699
app/controllers/frontend/products.php (fn_get_products): 33
app/functions/fn.catalog.php ({closure}): 6673
app/functions/fn.catalog.php (db_get_array): 6594
app/functions/fn.database.php (call_user_func_array): 28
app/Tygh/Database/Connection.php (getArray): 234
app/Tygh/Database/Connection.php (query): 454

It sounds like you may have a corrupt file or a file that wasn't updated during an upgrade.?

Looks like asc is reserved word by mySQL and the selected sorting tried to use it. Most possibly the issue is related with 3rd party module