我正在使用 HTML 选择输入,启用了多项选择,我正在查看选定的选项并尝试处理我的 SQL ...但是,我收到来自 SQL 的警告,告诉我如果我的选择语句是正确的,我应该使用“SET SQL_BIG_SELECTS = 1”,因为 JOIN 超过了限制?
这是我的查询:
"
SELECT wposts.*, wpostmeta.*
FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta, $wpdb->postmeta wpostmeta2, $wpdb->postmeta wpostmeta3
WHERE wposts.ID = wpostmeta.post_id
AND wposts.ID = wpostmeta2.post_id
AND wposts.ID = wpostmeta3.post_id
AND wpostmeta.meta_key = 'listing_subtype'
AND wpostmeta.meta_value = '$search_home_type'
AND wpostmeta2.meta_key = 'map_area'
AND ";
$count = 0;
foreach ($params['search_map_area'] as $map_area) :
if ( $count != 0 ) :
$querystr .= "OR ";
endif;
$querystr .= "wpostmeta2.meta_value = '$map_area' ";
$count++;
endforeach;
$querystr .= "AND wpostmeta3.meta_key = 'price_current'
AND wpostmeta3.meta_value BETWEEN $search_price_min AND $search_price_max
AND wposts.post_status = 'publish'
AND wposts.post_type = 'vreb_property'
ORDER BY wposts.post_date DESC
LIMIT 0, 20
";
有没有更好的方法来查询这个?OR wpostmeta2.meta_value = '$map_area'
这似乎是导致我的脚本超时的倍数......