我找了一个关键词用不同的句子测试测试了一下大家分析一下,后面是搜索到的信息条数:
sql="select * from news where key=1 and news_title like'%"&word&"%' " 303条
sql="select * from news where key=1 and news_title like'%"&word&"%' order by id desc" 303条
sql="select * from news where key=1 and news_content like'%"&word&"%' " 579条
sql="select * from news where key=1 and news_content like'%"&word&"%' order by id desc" 0条
sql="select * from news where key=1 and (news_title like'%"&word&"%' or news_content like'%"&word&"%') " 276条
sql="select * from news where key=1 and (news_title like'%"&word&"%' or news_content like'%"&word&"%') order by id desc" 0条
sql="select * from news where (key=1 and news_title like'%"&word&"%') or (key=1 and news_content like'%"&word&"%') " 276条
sql="select * from news where (key=1 and news_title like'%"&word&"%') or (key=1 and news_content like'%"&word&"%') order by id desc" 0条
我发现只要条件中含有 news_content 就不能用 order by 否则什么都搜不到