Checking on debug.log today we found the following error:
[07-Dec-2023 08:30:31 UTC] WordPress database error Unknown column 'wp_wc_order_stats.total_sales' in 'field list' for query
SELECT
SUM( CASE WHEN wp_wc_order_stats.parent_id = 0 THEN 1 ELSE 0 END ) as orders_count, SUM(wp_wc_order_stats.num_items_sold) as num_items_sold, ( SUM(wp_wc_order_stats.total_sales) + COALESCE( SUM(discount_amount), 0 ) - SUM(wp_wc_order_stats.tax_total) - SUM(wp_wc_order_stats.shipping_total) + ABS( SUM( CASE WHEN wp_wc_order_stats.net_total < 0 THEN wp_wc_order_stats.net_total ELSE 0 END ) ) ) as gross_sales, SUM(wp_wc_order_stats.total_sales) AS total_sales, COALESCE( SUM(discount_amount), 0 ) AS coupons, COALESCE( coupons_count, 0 ) as coupons_count, ABS( SUM( CASE WHEN wp_wc_order_stats.net_total < 0 THEN wp_wc_order_stats.net_total ELSE 0 END ) ) AS refunds, SUM(wp_wc_order_stats.tax_total) AS taxes, SUM(wp_wc_order_stats.shipping_total) AS shipping, SUM(wp_wc_order_stats.net_total) AS net_revenue, SUM( wp_wc_order_stats.num_items_sold ) / SUM( CASE WHEN wp_wc_order_stats.parent_id = 0 THEN 1 ELSE 0 END ) AS avg_items_per_order, SUM( wp_wc_order_stats.net_total ) / SUM( CASE WHEN wp_wc_order_stats.parent_id = 0 THEN 1 ELSE 0 END ) AS avg_order_value, COUNT( DISTINCT( wp_wc_order_stats.customer_id ) ) as total_customers
FROM
wp_wc_order_stats
LEFT JOIN (
SELECT
order_id,
SUM(discount_amount) AS discount_amount,
COUNT(DISTINCT coupon_id) AS coupons_count
FROM
wp_wc_order_coupon_lookup
GROUP BY
order_id
) order_coupon_lookup
ON order_coupon_lookup.order_id = wp_wc_order_stats.order_id
WHERE
1=1
AND ( wp_wc_order_stats.status NOT IN ( 'wc-auto-draft','wc-trash','wc-pending','wc-failed','wc-cancelled','wc-checkout-draft' ) ) AND wp_wc_order_stats.date_paid
<= '2023-12-07 23:59:59' AND wp_wc_order_stats.date_paid
>= '2023-12-01 00:00:00'
made by wp_dashboard, do_meta_boxes, WC_Admin_Dashboard->status_widget, WC_Admin_Dashboard->get_wc_admin_performance_data, rest_do_request, WP_REST_Server->dispatch, WP_REST_Server->respond_to_request, Automattic\WooCommerce\Admin\API\Reports\PerformanceIndicators\Controller->get_items, Automattic\WooCommerce\Admin\API\Reports\PerformanceIndicators\Controller->get_stats_data, rest_do_request, WP_REST_Server->dispatch, WP_REST_Server->respond_to_request, Automattic\WooCommerce\Admin\API\Reports\Orders\Stats\Controller->get_items, Automattic\WooCommerce\Admin\API\Reports\Orders\Stats\Query->get_data, WC_Data_Store->__call, Automattic\WooCommerce\Admin\API\Reports\Orders\Stats\DataStore->get_data, W3TC\DbCache_WpdbNew->query, W3TC\DbCache_WpdbInjection_QueryCaching->query, W3TC\_CallUnderlying->query, W3TC\DbCache_WpdbNew->query, W3TC\DbCache_WpdbInjection->query, W3TC\DbCache_WpdbNew->default_query
The column wp_wc_order_stats.total_sales is indeed missing.
We have developed the restyling of a website that we found with WooCommerce 3.x and we now have WooCommerce 7.7.1.
I tried to replicate the error but I apparently I couldn’t navigate to the page that generates the error. My local db is also missing that column (in fact it’s just a backup of the online db from yesterday).
I found the relative code in the file public/wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Stats/DataStore.php
and I thought that this file was called when visiting the page
https://www.qualenergia.loc/wp-admin/admin.php?page=wc-reports
but I still don’t get any errors in my local debug.log
Thanks for your help.
Best regards,
.S.
]]>/?s=e
WordPress database error Unknown column 'wp_tec_occurrences.start_date_utc' in 'field list' for query
SELECT SQL_CALC_FOUND_ROWS wp_posts.*, CAST( wp_tec_occurrences.start_date_utc AS DATETIME ) AS event_date_utc
FROM wp_posts LEFT JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id AND wp_postmeta.meta_key = '_EventHideFromUpcoming' ) LEFT JOIN wp_postmeta AS mt1 ON ( wp_posts.ID = mt1.post_id )
WHERE 1=1 AND (((wp_posts.post_title LIKE '%e%') OR (wp_posts.post_excerpt LIKE '%e%') OR (wp_posts.post_content LIKE '%e%'))) AND (
wp_postmeta.post_id IS NULL
AND
( mt1.meta_key = '_EventStartDateUTC' AND CAST(mt1.meta_value AS DATETIME) >= '2023-06-13 21:15:30' )
) AND wp_posts.post_type IN ('page', 'post', 'tribe_events') AND ((wp_posts.post_status = 'publish' OR wp_posts.post_status = 'tribe-ea-success' OR wp_posts.post_status = 'tribe-ea-failed' OR wp_posts.post_status = 'tribe-ea-schedule' OR wp_posts.post_status = 'tribe-ea-pending' OR wp_posts.post_status = 'tribe-ea-draft' OR wp_posts.post_status = 'private'))
GROUP BY wp_tec_occurrences.occurrence_id
ORDER BY event_date_utc DESC, wp_posts.post_title ASC, wp_posts.post_date ASC
LIMIT 12, 12
made by do_action('wp_ajax_us_ajax_grid'), WP_Hook->do_action, WP_Hook->apply_filters, us_ajax_grid, us_load_template, include('/plugins/us-core/templates/us_grid/listing.php'), apply_filters('us_grid_listing_query_args'), WP_Hook->apply_filters, the_events_calendar_us_grid_listing_query_args, tribe_get_events, Tribe__Events__Query::getEvents, WP_Query->get_posts
If plugin The Events Calendar is deactivated, the same ajax “load more” works fine and shows results.
In database wp_tec_occurrences.start_date_utc
exists and has values.
WP 6.2.2, theme Impreza 8.16 (latest), The Events Calendar 6.0.13.1
]]>SELECT posts_lot.post_title AS lot_post_title,
posts_lot.ID AS lot_ID,
posts_lot.post_content AS lot_post_content,
lot_meta_lot_status_tbl.meta_value AS lot_meta_lot_status,
lot_meta_room_tbl.meta_value AS lot_meta_room,
lot_meta_product_tbl.meta_value AS lot_meta_product
FROM fzMCGsSFposts AS posts_lot
INNER JOIN (SELECT lot_meta_lot_status_tbl_posts.ID as id, meta_value, meta_key FROM fzMCGsSFpostmeta AS lot_meta_lot_status_tbl_postmeta INNER JOIN fzMCGsSFposts AS lot_meta_lot_status_tbl_posts ON lot_meta_lot_status_tbl_postmeta.post_id = lot_meta_lot_status_tbl_posts.ID AND lot_meta_lot_status_tbl_posts.post_type = 'lot') AS lot_meta_lot_status_tbl
ON lot_meta_lot_status_tbl.meta_key = 'lot_status' AND lot_meta_lot_status_tbl.id = posts_lot.ID
INNER JOIN (SELECT lot_meta_room_tbl_posts.ID as id, meta_value, meta_key FROM fzMCGsSFpostmeta AS lot_meta_room_tbl_postmeta INNER JOIN fzMCGsSFposts AS lot_meta_room_tbl_posts ON lot_meta_room_tbl_postmeta.post_id = lot_meta_room_tbl_posts.ID AND lot_meta_room_tbl_posts.post_type = 'lot') AS lot_meta_room_tbl
ON lot_meta_room_tbl.meta_key = 'room' AND lot_meta_room_tbl.id = posts_lot.ID
INNER JOIN (SELECT lot_meta_product_tbl_posts.ID as id, meta_value, meta_key FROM fzMCGsSFpostmeta AS lot_meta_product_tbl_postmeta INNER JOIN fzMCGsSFposts AS lot_meta_product_tbl_posts ON lot_meta_product_tbl_postmeta.post_id = lot_meta_product_tbl_posts.ID AND lot_meta_product_tbl_posts.post_type = 'lot') AS lot_meta_product_tbl
ON lot_meta_product_tbl.meta_key = 'product' AND lot_meta_product_tbl.id = posts_lot.ID
WHERE 1=1
AND posts_lot.post_content > '0'
AND posts_lot.post_type = 'lot'
AND lot_status.meta_value = '1199'
Can you help me find the proper syntax to target the lot_status field with a where function?
Thanks very much! Let me know if you need more information.
]]>Got error ‘PHP message: WordPress database error Unknown column ‘wp_wc_order_stats.total_sales’ in ‘field list’ for query \n\t\t\tSELECT\n\t\t\t\tSUM( CASE WHEN wp_wc_order_stats.parent_id = 0 THEN 1 ELSE 0 END ) as orders_count, ( SUM(wp_wc_order_stats.total_sales) + COALESCE( SUM(discount_amount), 0 ) – SUM(wp_wc_order_stats.tax_total) – SUM(wp_wc_order_stats.shipping_total) + ABS( SUM( CASE WHEN wp_wc_order_stats.net_total < 0 THEN wp_wc_order_stats.net_total ELSE 0 END ) ) ) as gross_sales, SUM(wp_wc_order_stats.total_sales) AS total_sales, ABS( SUM( CASE WHEN wp_wc_order_stats.net_total < 0 THEN wp_wc_order_stats.net_total ELSE 0 END ) ) AS refunds, COALESCE( SUM(discount_amount), 0 ) AS coupons, SUM(wp_wc_order_stats.tax_total) AS taxes, SUM(wp_wc_order_stats.shipping_total) AS shipping, SUM(wp_wc_order_stats.net_total) AS net_revenue , wcml_language_postmeta.meta_value AS language\n\t\t\tFROM\n\t\t\t\twp_wc_order_stats\n\t\t\t\tLEFT JOIN (\n\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\torder_id,\n\t\t\t\t\t\t\tSUM(discount_amount) AS discount_amount,\n\t\t\t\t\t\t\t…PHP message: WordPress database error Unknown column ‘wp_wc_order_stats.total_sales’ in ‘field list’ for query \n\t\t\tSELECT\n\t\t\t\tDATE_FORMAT(wp_wc_order_stats.
date_created
, ‘%Y-%m-%d’) AS time_interval , MAX(wp_wc_order_stats.date_created) AS datetime_anchor , SUM( CASE WHEN wp_wc_order_stats.parent_id = 0 THEN 1 ELSE 0 END ) as orders_count, ( SUM(wp_wc_order_stats.total_sales) + COALESCE( SUM(discount_amount), 0 ) – SUM(wp_wc_order_stats.tax_total) – SUM(wp_wc_order_stats.shipping_total) + ABS( SUM( CASE WHEN wp_wc_order_stats.net_total < 0 THEN wp_wc_order_stats.net_total ELSE 0 END ) ) ) as gross_sales, SUM(wp_wc_order_stats.total_sales) AS total_sales, ABS( SUM( CASE WHEN wp_wc_order_stats.net_total < 0 THEN wp_wc_order_stats.net_total ELSE 0 END ) ) AS refunds, COALESCE( SUM(discount_amount), 0 ) AS coupons, SUM(wp_wc_order_stats.tax_total) AS taxes, SUM(wp_wc_order_stats.shipping_total) AS shipping, SUM(wp_wc_order_stats.net_total) AS net_revenue , wcml_language_postmeta.meta_value AS langua…’
These errors appear when this referer is called: /wp-admin/admin.php?page=wc-admin&path=%2Fanalytics%2Frevenue&chart=net_revenue&orderby=net_revenue&period=month&compare=previous_period
I thought about a transient cache issue or something, but running the bellow did not fix it.
$ wp transient delete woocommerce_reports-transient-version
Any idea
]]>it seems like there is a translation problem. I’m using the german version and my error logs show error for Unknown column 'Keine' in 'where clause' für Abfrage SELECT * FROM wp_nm_personalized WHERE productmeta_id = Keine
. This should be None
I guess.
The complete error:
[error] 699#699: *67098 FastCGI sent in stderr: "ugins/woocommerce/templates/taxonomy-product-tag.php'), wc_get_template, include('/themes/my-theme/woocommerce/archive-product.php'), wc_get_template_part, load_template, require('/themes/my-theme/woocommerce/content-product.php'), do_action('woocommerce_after_shop_loop_item_title'), WP_Hook->do_action, WP_Hook->apply_filters, woocommerce_template_loop_price, wc_get_template, include('/plugins/woocommerce/templates/loop/price.php'), WC_Product_Variable->get_price_html, apply_filters('woocommerce_get_price_html'), WP_Hook->apply_filters, ppom_woocommerce_alter_price, ppom_has_field_by_type, PPOM_Meta->__construct, PPOM_Meta->settingsPHP message: WordPress-Datenbank-Fehler Unknown column 'Keine' in 'where clause' für Abfrage SELECT * FROM wp_nm_personalized WHERE productmeta_id = Keine von require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/plugins/woocommerce/templates/taxonomy-product-tag.php'), wc_get_template, include('/themes/my-theme/woocommerce/archive-product.php'), wc_get_template_part, load_template, require('/themes/my-theme/woocommerce/content-product.php'), do_action('woocommerce_after_shop_loop_item'), WP_Hook->do_action, WP_Hook->apply_filters, woocommerce_template_loop_add_to_cart, wc_get_template, include('/plugins/woocommerce/templates/loop/add-to-cart.php'), WC_Product->add_to_cart_url, apply_filters('woocommerce_product_add_to_cart_url'), WP_Hook->apply_filters, NM_PersonalizedProduct->loop_add_to_cart_url, PPOM_Meta->__construct, PPOM_Meta->settingsPHP message: WordPress-Datenbank-Fehler Unknown column 'Keine' in 'where clause' für Abfrage SELECT * FROM wp_nm_personalized WHERE productmeta_id = Keine von require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/plugins/woocommerce/templates/taxonomy-product-tag.php'), wc_get_template, include('/themes/my-theme/woocommerce/archive-product.php'), wc_get_template_part, load_template, ...
Any suggestions?
]]>2021-09-28 11:49:59: Error occurred while updating SpamFireWall local base. Error: PROCESS FILE: WRITE ERROR: FAILED TO INSERT DATA: wp_cleantalk_sfw_temp DB Error: Unknown column ‘status’ in ‘field list’
]]>[29-May-2021 01:11:02 UTC] WordPress database error Unknown column 'source' in 'field list' for query SELECT
network, mask, status, source
FROM wp_cleantalk_sfw
WHERE network IN (3087007744,3103784960,3112173568,3114270720,3115319296,3115843584,3116105728,3116236800,3116302336,3116335104,3116343296,3116345344,3116345856,3116346112,3116346116,3116346117)
AND network = 3116346117 & mask
AND 58166
ORDER BY status DESC made by require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), include_once('/plugins/cleantalk-spam-protect/cleantalk.php'), apbct_sfw__check, Cleantalk\Common\Firewall->run, Cleantalk\ApbctWP\Firewall\SFW->check, Cleantalk\ApbctWP\DB->fetch_all
We are running PHP 7.4 and WordPress 5.7.2 with Cleantalk v.5.158.1. Please advise
]]>Unknown column 'match_url' in 'where clause' for query SELECT * FROM wp_redirection_items
When I do as requested and change the database version to 2.4, it forces me to upgrade the database, in which it goes back to 4.2 automatically.
I believe doing a manual upgrade of the database will yield the exact same problem.
What can be done about this?
]]>Unknown column ''
How can I investigate what’s causing it? I’m trying with TwentyTwenty and only WC activated…
Full error: [proxy_fcgi:error] [pid 3178592] [client *:60140] AH01071: Got error 'PHP message: WordPress database error Unknown column '' in 'where clause' for query SELECT DISTINCT posts.ID as product_id, posts.post_parent as parent_id FROM wp_posts posts\n\t\t\t LEFT JOIN wp_wc_product_meta_lookup wc_product_meta_lookup ON posts.ID = wc_product_meta_lookup.product_id\n\t\t\t LEFT JOIN wp_wc_product_meta_lookup parent_wc_product_meta_lookup\n\t\t\t ON posts.post_type = 'product_variation' AND parent_wc_product_meta_lookup.product_id = posts.post_parent \n\t\t\tWHERE posts.post_type IN ('product','product_variation')\n\t\t\t AND ( ( ( posts.post_title LIKE '%chorizo%') OR ( posts.post_excerpt LIKE '%chorizo%') OR ( posts.post_content LIKE '%chorizo%' ) OR ( wc_product_meta_lookup.sku LIKE '%chorizo%' ) OR ( wc_product_meta_lookup.sku = "" AND parent_wc_product_meta_lookup.sku LIKE '%chorizo%' ) )) \n\t\t\t AND posts.post_status IN ('private','publish') \n\t\t\t\n\t\t\tORDER BY posts.post_parent ASC, posts.post_title ASC\n\t\t\t LIMIT 30 \n\t\t\t made by do_action('wp_ajax_woocommerce_json_search_products_and_varia...',