使MYSQL选择更有效率

时间:2016-11-01 19:49:02

标签: mysql

我有一个非常长的Select语句,只会变得更长,我想知道是否有办法让它更高效,更小。

现在我有128种变体;

 or search_term_1 = '$newvalue'
 or search_term_2 = '$newvalue'
 or search_term_3 = '$newvalue'
 ....
 or search_term_1 LIKE '$newvalue1%'
 or search_term_2 LIKE '$newvalue1%'
 or search_term_3 LIKE '$newvalue1%'
 ....
 or search_term_1 LIKE '$newvalue2%'
 or search_term_2 LIKE '$newvalue2%'
 or search_term_3 LIKE '$newvalue2%'

search_term_1 来自 1-8 然后我正在搜索变量的不同变体 - 例如" bar"

所以我已经开始寻找" bar"," bar"," bar",",bar"然后所有这些复数化,所以列表变得越来越长。有没有办法压缩这个?

0 个答案:

没有答案