asp like查找的问题 不包含指定数据的话怎么写

来源:百度知道 编辑:UC知道 时间:2024/05/16 00:16:07
asp查找数据中 不包含指定内容的命令怎么写

取like相反的所有数据

select * from aaa where title not like '%哈哈%'

查找 aaa 表中 title 字段不包含 哈哈 的行

先查询符合条件的记录并记录id
然后在查询id不等于符合条件的id就可以了
大概程序就是这样
sql="select * from 表 where 查询字段名 like'%"&指定字符&"%'"
rs.open sql,conn,1,3
if rs.eof and rs.bof then
rs.close
sql="select * from 表"
rs.open sql,conn,1,3
else
do while not rs.eof
id=rs("id")
sql1="select * from 表"
rs1.open sql1,conn,1,3
if rs1.eof and rs1.bof then
response.write"对不起数据库中没有记录"
response.end
rs1.close
rs.close
else
do while not rs1.eof
if rs1("id")<>rs("id") then
response.write 标题字段
end if
rs1.movenext
loop
end if
rs.movenext
loop
end if

给楼主一个例子比拟即可
sql="select * from 表 where 查询字段名 like'%[!0-9]%'"
'以上是查询字段中不含有0-9的数字