title: MySQL SUM do not return proper value, it removes decimal places. How to prevent this?
body: <p>This is very strange to me, I see it first time in my life. I do not know is this proper behavior or something is wrong. I hope some one will be able to enlighten me.</p>
  
  <p>This is my simple SQL Fiddle: <a href="http://sqlfiddle.com/#!8/ba125/4" rel="nofollow">http://sqlfiddle.com/#!8/ba125/4</a>  </p>
  
  <p>What I want to do is very simple. I want to sum all money for the group of energy. So there is table column called <strong>group</strong>. And not surprisingly it hold the names of groups that companies can belong to. Among others, there is group called "energy". There is also one more column, called "money". It holds the amount of money that each company is making over year ( profit ). I need to sum all profit ( money ) for companies belonging to "energy" group. Sounds simple, but I have a problem. In money table, money is stored as varchar in this format "1.234.567", meaning that this company have profit of 1 million 234 thousands... I am not guilty that this format is used, I am working on system made long before I started to work on it. But where is my problem ? Well, if you look at the fiddle, I am executing one simple query that is selection money for energy group:</p>
  
  <p><code>select money from finance where group = "energy"</code></p>
  
  <p>And it displays nicely how much money each company made. But if I execute this query: </p>
  
  <p><code>select sum(money) as total from finance where group = "energy"</code></p>
  
  <p>I get strange result of <strong>99.317</strong>, and I was hoping for <strong>18.103.571</strong>. What the heck is going on here ? Is there any hope for me to get right result ? Thank you</p>