问一下sql语法的问题?

xfyz 2002-05-08 09:07:54
sql="select * from route where oldprice < '"+replace(result_oldprice,"'","''")+"' order by routeid"

在查询中,我想从数据库中,显示比result_oldprice低的价格的所有记录,该怎么写呢?谢谢
...全文
42 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
spgoal 2002-05-09
  • 打赏
  • 举报
回复
oldprice=clng(replace(result_oldprice,"'","''"))
sql="select * from route where oldprice < "+oldprice+" order by routeid"
shadowkiss 2002-05-08
  • 打赏
  • 举报
回复
类型自己要清楚才行
chonboy 2002-05-08
  • 打赏
  • 举报
回复
你必须保证比较的数据是数字,否则别执行这条语句。
superauu 2002-05-08
  • 打赏
  • 举报
回复
sql="select * from route where oldprice < " & cint(result_oldprice) & " order by routeid"
cmsoft 2002-05-08
  • 打赏
  • 举报
回复
字段类型与输入数据类型不配
ChinaOk 2002-05-08
  • 打赏
  • 举报
回复
数字类型就不用再replace了。
因为如果含有'那就输入错误了。

sql="select * from route where oldprice < "+result_oldprice+" order by routeid"
xfyz 2002-05-08
  • 打赏
  • 举报
回复
数字!
ChinaOk 2002-05-08
  • 打赏
  • 举报
回复
sql="select * from route where oldprice < "+replace(result_oldprice,"'","''")+" order by routeid"
oldprice是什么类型?

http://www.hqtcn.com
Sql语法

28,391

社区成员

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

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