急求一SQL查询语句,在线等。。。。

pwf825 2009-06-05 08:36:46
access数据库中表test有一字段field1的值是浮点型小数,但用文本形式即字符串形式存储的,现在我想查处在浮点数a 和浮点数b 之间的field1字段的所有信息;
小弟我写了个format('select * from test where field1 between %s and %s',['a','b'])
a 和b都是变量
请各位高手们分析下
...全文
32 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
pwf825 2009-06-05
  • 打赏
  • 举报
回复
谢谢各位的关注,小弟写出来了,用个类型转换val
select * from test where val(field1) between %s and %s'
散分了。。。
pwf825 2009-06-05
  • 打赏
  • 举报
回复
to:ks_reny
format('select * from test where field1 between %f and %f',['a','b'])
改為%f 試試. 这个报错,我还换成%e试过,都不行;报错Format %f invalid or incompatible with argument

to: firefly_2008
语法错误,操作符丢失
firefly_2008 2009-06-05
  • 打赏
  • 举报
回复
select * from test where cast(field1 as float) between %s and %s'
ks_reny 2009-06-05
  • 打赏
  • 举报
回复
[Quote=引用楼主 pwf825 的帖子:]
access数据库中表test有一字段field1的值是浮点型小数,但用文本形式即字符串形式存储的,现在我想查处在浮点数a 和浮点数b 之间的field1字段的所有信息;
小弟我写了个format('select * from test where field1 between %s and %s',['a','b'])
a 和b都是变量
请各位高手们分析下
[/Quote]
format('select * from test where field1 between %f and %f',['a','b'])
改為%f 試試.
pwf825 2009-06-05
  • 打赏
  • 举报
回复
a 和 b是变量,就是有一个值 x ,求x在误差5%范围内的值,即a = 0.95x; b = 1.05x
select * from test where field1 between a and b 这样写不对
lihan6415151528 2009-06-05
  • 打赏
  • 举报
回复
select * from test where field1 between a and b 

22,207

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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