|
|
假设,我有一个table (mapinfo), 内有column ( maplocation, city, state, poscode, areacovered)
我要search by keyword, 假如我打bangsar, 那么column里的资料如果有bangsar这个字的话result就会display出来。
那么
$query = "select maplocation from mapinfo where maplocation or city or poscode or state or areacovered like \"%$trimmed%\"
order by city"
对吗?
还有更好的方法吗? |
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 30-3-2008 08:35 PM
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|
发表于 6-4-2008 08:04 PM
|
显示全部楼层
我觉得如果keyword是一定只出现在某个colum的话,为什么还需要搜寻其他不相干的column?
比如类似Bangsar的字眼肯定只可能出现在City column里的话,那就不必search其他的column了,不是吗? |
|
|
|
|
|
|
|
|
|
|
发表于 12-4-2008 10:40 PM
|
显示全部楼层
|
如果你的database engine可以把几个columns连接(concat)起来的话会更好 |
|
|
|
|
|
|
|
|
|
|
发表于 13-4-2008 01:35 AM
|
显示全部楼层
|
如果真的要搜索全部column的话,建立一个新的column, 然后用Full Text Index/Search 吧,但是要注意 performance |
|
|
|
|
|
|
|
|
| |
本周最热论坛帖子
|