我使用wp\u查询我有很多参数要比较,所以我必须使用多个meta\u查询(12)
查询将创建一个包含至少12个内部联接的大型sql语句
这种行为使mysql服务器挂起(即使表非常小)
有解决办法吗?
除了用php过滤结果之外?
Array
(
[post_type] => financing
[posts_per_page] => 20
[meta_query] => Array
(
[0] => Array
(
[key] => family_status
[value] => "נשוי"
[compare] => LIKE
)
[1] => Array
(
[key] => has_appartment
[value] => 1
[compare] => =
)
[2] => Array
(
[key] => gender
[value] => "זכר"
[compare] => LIKE
)
[3] => Array
(
[key] => occupational_status
[value] => "שכיר"
[compare] => LIKE
)
[4] => Array
(
[key] => min_in_bank_stage
[value] => 1
[compare] => <=
[type] => NUMERIC
)
[5] => Array
(
[key] => max_children
[value] => 2
[compare] => >=
[type] => NUMERIC
)
[6] => Array
(
[key] => minimum_monthly_income
[value] => 12222
[compare] => <=
[type] => NUMERIC
)
[7] => Array
(
[key] => min_age
[value] => 3
[compare] => <=
[type] => NUMERIC
)
[8] => Array
(
[key] => max_age
[value] => 3
[compare] => >=
[type] => NUMERIC
)
[9] => Array
(
[key] => mortgage_payment_min
[value] => 1222
[compare] => <=
[type] => NUMERIC
)
[10] => Array
(
[key] => mortgage_payment_max
[value] => 1222
[compare] => >=
[type] => NUMERIC
)
[11] => Array
(
[key] => other_payments_amount_min
[value] => 111
[compare] => <=
[type] => NUMERIC
)
[12] => Array
(
[key] => other_payments_amount_max
[value] => 111
[compare] => >=
[type] => NUMERIC
)
)
)
1条答案
按热度按时间xmjla07d1#
根据你发帖的结果,我给你举了一个例子。所以,你可以试试这个代码,
希望你明白!!