title: Combine two MySQL queries with calculation
body: <p>I have got two tables with different information but want to combine them into the report as one table. </p>
  
  <p>I could manage to combine tables with this queries:</p>
  
  <pre><code>SELECT `id`, `name`, `info`, `food`, `drinks`, `service`, `ambience`, `hygiene`, `recommend`, `best_menu`, `best_service`, `author`, `username` 
  FROM `restaurants` RIGHT JOIN `rating` ON `rating`.`rid` IN (1,2,3);
  </code></pre>
  
  <p>But want to calculate all ratings and show in a compact view with name and info like this one:</p>
  
  <pre><code>SELECT `rid` as `id`, COUNT(*) as `count`, AVG(`food`+`drinks`+`service`+`ambience`+`hygiene`) as `average`, SUM(`food`) as `food`, SUM(`drinks`) as `drinks`, SUM(`service`) as `service`, SUM(`ambience`) as `ambience`, SUM(`hygiene`) as `hygiene`, concat(round(( SUM(`recommend`)/COUNT(*) * 100 ),2),'%') as `recommended`, `best_menu` as `best`, `best_service` as `service`, `voted` as `last vote` 
  FROM `rating` WHERE `rid` IN (3,1,2) GROUP BY `rid` ORDER BY `best_menu`, `best_service`;
  </code></pre>
  
  <p>So my goal is to bring "name" and "info" columns from the first table to the second one.</p>
  
  <p>Please see the example here:</p>
  
  <p><a href="http://sqlfiddle.com/#!9/d5589/35" rel="nofollow noreferrer">http://sqlfiddle.com/#!9/d5589/35</a></p>
  
  <p>Highly appreciate your help!</p>