Commit bc1c0d820c for woocommerce

commit bc1c0d820cf84a85d9dca9e4b982cedf1ab1886d
Author: Ethan Vaz <97713496+EthanVaz11@users.noreply.github.com>
Date:   Tue Nov 4 04:05:33 2025 +0530

    Fix: Customer Table not populating due to error caused when ANSI_QUOTES setting is enabled in Database Setting (#61212)

diff --git a/plugins/woocommerce/changelog/61212-customer-analytics-fix b/plugins/woocommerce/changelog/61212-customer-analytics-fix
new file mode 100644
index 0000000000..9961d97e4c
--- /dev/null
+++ b/plugins/woocommerce/changelog/61212-customer-analytics-fix
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+This PR fixes the bug where Customer Analytics are not getting populated for DBs with ANSI_QUOTES enabled
\ No newline at end of file
diff --git a/plugins/woocommerce/changelog/61212-fix-customer-analytics-fix-with-ansi_quotes-enabled b/plugins/woocommerce/changelog/61212-fix-customer-analytics-fix-with-ansi_quotes-enabled
new file mode 100644
index 0000000000..bf03ca9942
--- /dev/null
+++ b/plugins/woocommerce/changelog/61212-fix-customer-analytics-fix-with-ansi_quotes-enabled
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+This PR fixes the bug where Customer Analytics are not getting populated for DBs with ANSI_QUOTES enabled
diff --git a/plugins/woocommerce/src/Admin/API/Reports/Customers/DataStore.php b/plugins/woocommerce/src/Admin/API/Reports/Customers/DataStore.php
index 0046129cd5..7c711d56aa 100644
--- a/plugins/woocommerce/src/Admin/API/Reports/Customers/DataStore.php
+++ b/plugins/woocommerce/src/Admin/API/Reports/Customers/DataStore.php
@@ -82,7 +82,8 @@ class DataStore extends ReportsDataStore implements DataStoreInterface {
 			'state'            => 'state',
 			'postcode'         => 'postcode',
 			'date_registered'  => 'date_registered',
-			'date_last_active' => 'IF( date_last_active <= "0000-00-00 00:00:00", NULL, date_last_active ) AS date_last_active',
+			// Use single quotes for string literals to ensure compatibility with sql_mode=ANSI_QUOTES.
+			'date_last_active' => "IF( date_last_active <= '0000-00-00 00:00:00', NULL, date_last_active ) AS date_last_active",
 			'date_last_order'  => "MAX( {$wpdb->prefix}wc_order_stats.date_created ) as date_last_order",
 			'orders_count'     => "{$orders_count} as orders_count",
 			'total_spend'      => "{$total_spend} as total_spend",