我在windows&中运行了这个sql Linux版的mysql,得到不同的结果:
select (((((237803.3300+1659482.4400)/2.00)/1182208.5700)*30.00*6)+
(0.50*`(((((((1159248.2000+687984.6000)/2.00)/1527268.4000)*30.00*6)+
((((457300.0000+1707654.0300)/2.00)/1182208.5700)*30.00*6))
-(((((360.00*((1527268.4000-1182208.5700)-((2587.0000-((5354427.3100*0.0400*6)/12.00))
+99354.4800+10550.5600)))/((((((1159248.2000+687984.6000)/2.00)/1527268.4000)*30.00*6)+
((((457300.0000+1707654.0300)/2.00)/1182208.5700)*30.00*6))*0.5))-(0.50*((2587.0000-
((5354427.3100*0.0400*6)/12.00))+99354.4800+10550.5600)))*
(((((1159248.2000+687984.6000)/2.00)/1527268.4000)*30.00*6)+
((((457300.0000+1707654.0300)/2.00)/1182208.5700)*30.00*6)))/1182208.5700))-
((((237803.3300+1659482.4400)/2.00)/1182208.5700)*30.00*6)))) AS YF`
Windows版本的mysql结果:105.93639914104807268662689486
Linux版的mysql结果:144.43789669025999363208811782
我已经在java,excel这样的其他平台上检查了这个表达式,得到了大约值:105.93 .....所以我想到linux mysql上的计算是不正确的还是一些mysql变量设置不正确?谁能告诉我为什么?
我的linux版mysql(在云端服务器上):
mysql>SHOW VARIABLES LIKE "%version%"
+-------------------------+---------------------------------+
| Variable_name | Value |
+-------------------------+---------------------------------+
| innodb_version | 1.1.8-20.1 |
| protocol_version | 10 |
| slave_type_conversions | |
| version | 5.5.18.1-Alibaba-rds-201406-log |
| version_comment | Source distribution |
| version_compile_machine | x86_64 |
| version_compile_os | Linux |
+-------------------------+---------------------------------+
答案 0 :(得分:-2)
我没有仔细观察,但你没有在任何地方选择FROM
试试这个:
select (((((237803.3300+1659482.4400)/2.00)/1182208.5700)*30.00*6)+(0.50*(((((((1159248.2000+687984.6000)/2.00)/1527268.4000)*30.00*6)+((((457300.0000+1707654.0300)/2.00)/1182208.5700)*30.00*6))-(((((360.00*((1527268.4000-1182208.5700)-((2587.0000-((5354427.3100*0.0400*6)/12.00))+99354.4800+10550.5600)))/((((((1159248.2000+687984.6000)/2.00)/1527268.4000)*30.00*6)+((((457300.0000+1707654.0300)/2.00)/1182208.5700)*30.00*6))*0.5))-(0.50*((2587.0000-((5354427.3100*0.0400*6)/12.00))+99354.4800+10550.5600)))*(((((1159248.2000+687984.6000)/2.00)/1527268.4000)*30.00*6)+((((457300.0000+1707654.0300)/2.00)/1182208.5700)*30.00*6)))/1182208.5700))-((((237803.3300+1659482.4400)/2.00)/1182208.5700)*30.00*6)))) AS YF
FROM DUAL
Answer: 105.936399141048