存进去的时候没做过索引和专门的数据库设计,那只能用like的方法查
解决方案 »
- 请教一个语句怎么写?谢谢!
- 求一条件sql语句
- sqlserver数据库转换到access数据库
- 各位大哥,我是初学者,请问怎么能用create table 建立一个表,让它存在你指定的数据库中
- 报表算法
- 请教高手:判断要修改的字段列值是否与该字段其它列值重复(本身值除外)?
- 安全性问题
- 重装了一下,公司的代码管理软件客户端ClearCase,导致SQLServer现在无法启动,除了重装有没有其它好办法?谢谢了!
- Unable to read local eventlog错误,那位能搞定 50分马上给(在线等到16:20)
- 基础问题,请高手指教
- ****小问题.sql 语句创建表,默认值为-3 非空 float类型****
- 一道数据库实际应用的考题
1. like '%天气%' 用不到索引 不过2005的可以2 建议你改成
select Tag,Title,Synopsis from New where 1=1 and Tag like '%天气%'
union all
select Tag,Title,Synopsis from New where 1=1 and Title like '%天气%'
union all
select Tag,Title,Synopsis from New where 1=1 and synopsis like '%天气%'
--try
select Tag,Title,Synopsis from New where charindex('天气',Tag)+ charindex('天气',Title)+charindex('天气',synopsis)>0
--显示加上排序:
select * from New where
charindex('天气',tag)>0 or charindex('天气',title)>0 or charindex('天气',synopsis)>0
order by case when charindex('天气',tag)>0 then 0
when charindex('天气',title)>0 then 1
when charindex('天气',synopsis)>0 then 2 end