简体   繁体   English

MySQL查询将不起作用

[英]MySQL query won't work

I have been trying to run that query for quite some time now yet "won" isn't being set to a decimal value regardless of if I use quotes on the value or not. 我已经尝试运行该查询一段时间了,但是无论是否在值上使用引号,“ won”都不会设置为十进制值。

UPDATE trans 
   SET `outtrans` = 'test1', 
       `won` = '23.00043' 
  WHERE `intrans`='test1'

If I change the value of outtrans to a different one, it says 1 rows affected. 如果我将outtrans的值更改为其他值,则表示受影响的行数为1。 Yet if I do the same for won , it says 0 rows affected. 但是,如果我对won进行相同操作,则表示0行受到影响。

I am not using any APIs, just vanilla mysql. 我没有使用任何API,只是使用普通的mysql。

Sorry for wasting your time guys, turned out the table I was trying to set as decimal was int and another column was decimal instead. 抱歉浪费您的时间,原来我要设置为十进制的表是int,而另一列是十进制。 Thanks for all the effort. 感谢您的所有努力。

As Eric suggested, remove the quotations from the column names. 如Eric所建议,从列名称中删除引号。 Also, so into the table structure and make sure the length/value for you decimal column is set to house stuff after the decimal point. 同样,进入表结构,并确保将您的小数列的长度/值设置为小数点后的内容。 For example, i just built a test table to work on this and despite having the column set to decimal, the default length was 10,0, the 0 indicating no storage of digits after the decimal point. 例如,我只是建立了一个测试表来处理此问题,尽管将列设置为十进制,但默认长度为10,0,0表示小数点后没有数字存储。 I changed it to 10,4 and all was good. 我将其更改为10,4,一切都很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM