一个sql语句的问题?进来看看哦。

jsidiot 2002-03-12 10:35:22
select * from basic_price where distin = 'B' and custom = '5' and (num2 < 334 or num1 > 444 ) 我想使num2 < 334 和num1 > 444中的条件至少有一个为必选这样写对吗??但是我调试出来的结果却是不对的请指教
...全文
38 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
songzx66 2002-03-15
  • 打赏
  • 举报
回复
没明白
jsidiot 2002-03-15
  • 打赏
  • 举报
回复
顶一下
jsidiot 2002-03-12
  • 打赏
  • 举报
回复
但是为什么不能有正确的结果呢
我把代码给各位贴出来
set tempRS=server.createobject("adodb.recordset")
if request("id")="" then
ssql="select * from basic_price where distin = '"&request("distin")&"' and custom = '"&request("customID")&"' and (num2 < "&request("num0")&" or num1 > "&request("num1")&" ) "
else
ssql="select * from basic_price where (num2 < "&request("num0")&" or num1 > "&request("num1")&" ) and (distin = '"&request("distin")&"' and custom = '"&request("customID")&"') and code <> '"&request("id")&"'"
End if
response.write ssql
TempRS.open ssql,dicCon,1
response.end

if not tempRS.eof then
While not tempRS.eof
%>
<script language=javascript>
alert("您添加的数据在数据库中已经存在!");
history.back();
</script>
<%
tempRS.movenext
Wend
else
if request("id")="" then
rs.open "basic_price",dicCon,1,3
rs.addnew
else
rs.open "select * from basic_price where code = "&request("id"),dicCon,1,3
end if

if trim(request("distin"))<>"" then rs("distin")=trim(request("distin"))
if trim(request("num0"))<>"" then rs("num1")=request("num0")
if trim(request("num1"))<>"" then rs("num2")=request("num1")
if trim(request("price"))<>"" then rs("price")=trim(request("price"))
if trim(request("customID"))<>"" then rs("custom")=trim(request("customID"))

rs.update
rs.close

'response.redirect "custom_distin.asp?id="&request("customID")
End if

我试过了,老是不行,
camel_bird 2002-03-12
  • 打赏
  • 举报
回复
i think so
shadowkiss 2002-03-12
  • 打赏
  • 举报
回复
no problem.
aspboys 2002-03-12
  • 打赏
  • 举报
回复
用个sql语句嵌套
songzx66 2002-03-12
  • 打赏
  • 举报
回复
对啊,
hnshuer 2002-03-12
  • 打赏
  • 举报
回复
可以~!OK!
jsidiot 2002-03-12
  • 打赏
  • 举报
回复
语句不错
但是结果不对,不是我索要的结果
你看看我的意图

数据库里面明明有一条记录是num1为0,num2为333
现在我要把两个值分别添加到里面阿,334添加到num1里面,444添加到num2里面,在添加之前我要先判断334和444不在0-333里面,
其次我要判断334-444之间不能包含了0-333的数值,
请问如何添加呢
hnshuer 2002-03-12
  • 打赏
  • 举报
回复
错在那行?
jsidiot 2002-03-12
  • 打赏
  • 举报
回复
有人吗?
jsidiot 2002-03-12
  • 打赏
  • 举报
回复
那位老大过来看看阿
我的数据库里面明明有一条记录是num1为0,num2为333
现在我要把两个值分别添加到里面阿,334添加到num1里面,444添加到num2里面,在添加之前我要先判断334和444不在0-333里面,
其次我要判断334-444之间不能包含了0-333的数值,
请问如何添加呢

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧