Refactor SQL for segment in country to use join instead subselect
[MAILPOET-3226]
This commit is contained in:
committed by
Veljko V
parent
1ec4300153
commit
d4fbe95aef
@@ -27,10 +27,14 @@ class WooCommerceCountry implements Filter {
|
|||||||
$subscribersTable,
|
$subscribersTable,
|
||||||
$wpdb->postmeta,
|
$wpdb->postmeta,
|
||||||
'postmeta',
|
'postmeta',
|
||||||
"postmeta.meta_key = '_customer_user'
|
"postmeta.meta_key = '_customer_user' AND $subscribersTable.wp_user_id=postmeta.meta_value"
|
||||||
AND $subscribersTable.wp_user_id=postmeta.meta_value
|
)->innerJoin(
|
||||||
AND postmeta.post_id NOT IN ( SELECT id FROM {$wpdb->posts} as p WHERE p.post_status IN ('wc-cancelled', 'wc-failed'))"
|
'postmeta',
|
||||||
)->innerJoin('postmeta',
|
$wpdb->posts,
|
||||||
|
'posts',
|
||||||
|
"postmeta.post_id = posts.id AND posts.post_status NOT IN ('wc-cancelled', 'wc-failed')"
|
||||||
|
)->innerJoin(
|
||||||
|
'postmeta',
|
||||||
$wpdb->postmeta,
|
$wpdb->postmeta,
|
||||||
'postmetaCountry',
|
'postmetaCountry',
|
||||||
"postmeta.post_id = postmetaCountry.post_id AND postmetaCountry.meta_key = '_billing_country' AND postmetaCountry.meta_value = :$countryFilterParam"
|
"postmeta.post_id = postmetaCountry.post_id AND postmetaCountry.meta_key = '_billing_country' AND postmetaCountry.meta_value = :$countryFilterParam"
|
||||||
|
Reference in New Issue
Block a user