title: Find the average of two combined columns in sql
body: <p>I want to find the avg of the total of two columns. I want to count the total of col1 and the total of col2 then find the average(how many different rows they are in).</p>
  
  <p>I have managed to come up with a solution in the this <a href="http://www.sqlfiddle.com/#!2/82193/1" rel="noreferrer">sqlfiddle</a> (also see below) is this the best way?  I initially thought I would need to use the avg function but couldn't work it out using this.</p>
  
  <pre><code>    CREATE TABLE test (
          id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
          uid INT,
          col1 INT,
          col2 INT
      ) DEFAULT CHARACTER SET utf8 ENGINE=InnoDB;
  
      INSERT INTO test (id, uid, col1, col2) VALUES
      (1,5,8,12),
      (2,1,2,3),
      (3,1,2,33),
      (4,5,25,50),
      (5,5,22,3);
  
      (
      SELECT ((sum(col1) + sum(col2))/count(*))
      FROM test
        WHERE uid=5
      )
  </code></pre>