以下为引用的内容:
For i = 0 To sck
SQL = SQL & tempJoinWord & "(" & _
"alice like '"&ck(i)&"%')"
tempJoinWord = " and "
Next
在二个字段中同时查询
以下为引用的内容:
For i = 0 To sck
SQL = SQL & tempJoinWord & "(" & _
"alice like '"&ck(i)&"%' or " & _
"alice1 like '"&ck(i)&"%')"
tempJoinabigale = " and "
Next
以下为引用的内容:
select * from News where Title like '%"&abigale&"%'
or Author like '%"&abigale&"%' order by Id desc
从字段Title和Author中模糊检索,按Id排序
查询时间:50秒
方案2:
主键Id,默认为聚集索引
在Title、Author、Star上建立非聚集索引
以下为引用的内容:
select * from News where Title like '"&abigale&"%'
or Author like '"&abigale&"%' order by Id desc作者: lbsong 时间: 2008-12-11 15:44 标题: SQL Server数据库查询优化的常用方法总结 从字段Title和Author中模糊检索,按Id排序
查询时间:2 - 2.5秒
方案3:
主键Id,默认为聚集索引
在Title、Author、Star上建立非聚集索引
以下为引用的内容:
select * from News where Title like '"&abigale&"%'
or Author like '"&abigale&"%' order by Star desc
从字段Title和Author中模糊检索,按Star排序
查询时间:2 秒
方案4:
主键Id,默认为聚集索引
在Title、Author、Star上建立非聚集索引
以下为引用的内容:
select * from News where Title like '"&abigale&"%' or Author like '"&abigale&"%'
从字段Title和Author中模糊检索,不排序查询时间:1.8 - 2 秒
方案5:
主键Id,默认为聚集索引
在Title、Author、Star上建立非聚集索引
以下为引用的内容:
select * from News where Title like '"&abigale&"%'
或
select * from News where Author like '"&abigale&"%'