|
蓝森林 http://www.lslnet.com 2006年8月25日 8:28
..那查找字段包含字符串,应该用什么语句???
查找字段用:select * form data where name=name
那查找字段包含字符串,应该如何??
(例如:数据表名为data) |
like
其中语句中的table表示表名,str表示字符型文本。
统计数据:sql="select count(*) as id from table",调用:<%=rs("id")%>
精确查询:sql="select * from table where auther="&str&"order by id desc"
模糊查询:sql="select * from table where title like %"&str&"%order by id desc"
随机查询:Randomize
rid=int(rnd*20+1)
Set test_ti=Conn.Execute("SELECT * from table where id="&rid)
从表中取出第N条到第M条记录:SELECT TOP m-n+1 * FROM table WHERE (id NOT IN (SELECT TOP n-1 id FROM table))
随机取出n条记录:Sql server:select top n * from 表 order by newid()
Access:SELECT top n * FROM 表 ORDER BY Rnd(id)
mysql:Select * From 表 Order By rand() Limit n |
如果配置了索引还可以使用Contains,,,,ContainsTable,,,,FreeText,,,,,FreeTextTable |
|