title: What is the return type of SUM() in mysql?
body: <p>I am writing a program in C#.NET
  I would like to gather the total frequency of a class (let imagine every class has many words and each word has its own frequency in the corresponding class)</p>
  
  <p>So i used the sum() function in mysql. But there is an error saying that my cast is wrong.</p>
  
  <pre><code> public void average_each_type()
          {
              MySqlDataReader result;
              int total_freq = 0;
              string type = "";
  
              command.CommandText = "select class_name ,SUM(frequency) as sum_of_freq from training_set group by class_name ";
  
  
                  result = command.ExecuteReader();
                  while (result.Read())
                  {
  
                      total_freq = (int)result["sum_of_freq"]; //error happened here
                      type = result["class_name"].ToString();
                      //.....then so on...//
  </code></pre>