让我郁闷的mysql

i_saw_you 2008-12-17 11:00:52
我用的版本是 server version: 5.0.18-standard-log
出现的问题是在数据库中存在一条数据 weight=1.20 的数据(浮点型)
但是怎么都用等值查寻查不出来 select * from table where weight=1.20
崩溃 同事说是mysql版本问题 真郁闷。
...全文
104 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
i_saw_you 2008-12-18
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 josy 的回复:]
SQL codesql='select * from table where weight='+$wgt
[/Quote]
這樣不行! 答5樓
是float
懒得去死 2008-12-17
  • 打赏
  • 举报
回复
你的那个字段是什么类型的?
double or float or decimal?
cdshrewd 2008-12-17
  • 打赏
  • 举报
回复
sql='select * from table where cast(weight as DECIMAL(8,2))=+$wgt
百年树人 2008-12-17
  • 打赏
  • 举报
回复
sql='select * from table where weight='+$wgt

i_saw_you 2008-12-17
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 josy 的回复:]
确认是浮点型吗?

select * from table where weight>1.19 and weight <1.21 这样是什么结果?
[/Quote]這樣是有數據的 顯示的是 | 1.20 | 可是我是要用程序進行等值查詢不知道有什麼辦法嗎?
查詢的sql是這樣的 sql="select * from table where weight=$wgt "
百年树人 2008-12-17
  • 打赏
  • 举报
回复
确认是浮点型吗?

select * from table where weight>1.19 and weight<1.21 这样是什么结果?

56,679

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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