title: SQL query, sum of of entries with the same type(name)
body: <p>Hello i've got 3 different databases which list some different stuff about books. Im looking to find a way to write a SQL function which gives me the sum of books selled in every subsidiary(branch) and only the ones where the total sum is bigger than 2700 + the genre has to be romance. Ive easily figured out the function : </p>
  
  <pre><code>SELECT name, SUM(num_sell)  as 'numSum' 
  FROM subsidiary,subsidiarybook,book 
  WHERE genre= "Romance" 
  group by name
  </code></pre>
  
  <p>As you guys cant see all of the datastuff thats going around there, I just want to ask why im always only getting the different names of the branches with the exact same total output. I guess it just takes the total of the first one and not the actual sum belonging to the different names.</p>
  
  <p>Output looks like following : </p>
  
  <pre><code>Amazonhive          5163400
  Celestial Library   5163400
  Cloudcast           5163400
  Cosmic Library      5163400
  Globalworld         5163400
  Imaginetworks       5163400
  Leopardworks        5163400
  Quick Rooster Media 5163400
  Radiantelligence    5163400
  Royal Library       5163400
  Sphinx Brews        5163400
  Spring Harbor ...   5163400
  Surge Records       5163400
  Tiny Mermaid Arts   5163400
  Triumphoods         5163400
  Tucan Productions   5163400
  </code></pre>
  
  <p>These values should be different since the sum of these isnt the same for sure. Would appreciate the help. Also how can i check if the sum is > 2700 ?  putting a " AND num_sell >2700" behind the where as it would work normally isnt working in this case.</p>