注册 登录
编程论坛 ASP技术论坛

查询数值范围,无法显示数据.!

cnawe 发布于 2008-09-18 23:53, 1671 次点击
<%
    strSql="select * from [house] int(pay)<=int('" & search_jg_max & "') order by id desc"
    set rs=Server.CreateObject("ADODB.RecordSet")
    rs.open strSql,conn,3,3
%>
请问这样写对不对呢.
10 回复
#2
yms1232008-09-19 00:26
strSql="select * from [house] where pay<=" & search_jg_max & " order by id desc"
#3
cnawe2008-09-19 20:57
非常感谢.
#4
cnawe2008-09-19 22:00
不是很准,不知为什么.
#5
yms1232008-09-20 00:15
[bo][un]cnawe[/un] 在 2008-9-19 22:00 的发言:[/bo]

不是很准,不知为什么.

那就是你的程序问题了
#6
cnawe2008-09-21 00:10
如何排除查询数据呢.
#7
cnawe2008-09-21 00:11
<%
    strSql="select * from [house] int(pay)<>int('" & search_jg_max & "') order by id desc"
    set rs=Server.CreateObject("ADODB.RecordSet")
    rs.open strSql,conn,3,3
%>
#8
sunfishy2008-09-21 10:50
排除查询数据

个人意见:可以用查询"小于等于'含有查询数据'"的语句来排除.

sql语句如下:

"select * from onetable where pay <=
(
select pay from onetable
where pay like '%"&search_jg_max&"'%
)
and ....."

====省略号为其它条件.

[[it] 本帖最后由 sunfishy 于 2008-9-21 10:57 编辑 [/it]]
#9
cnawe2008-09-21 20:23
我的意思是,如何排除重复的数据
#10
multiple19022008-09-21 21:19
似乎有个distinct关键字来着
#11
madpbpl2008-09-21 22:17
多个字段建议用group by
1