title: Get sum of data in several firebase nodes
body: <p>I'm developing an ionic 2 app.
  I have this kind of data in firebase 
  <img src="https://i.stack.imgur.com/cdyvX.png" alt="image"></p>
  
  <p>what i need is go throgh the <strong>exams</strong> node and get total of all marks.
  in firebase docs there are examples like this.</p>
  
  <pre><code>var query = firebase.database().ref("users").orderByKey();
  query.once("value")
    .then(function(snapshot) {
      snapshot.forEach(function(childSnapshot) {
        // key will be "ada" the first time and "alan" the second time
        var key = childSnapshot.key;
        // childData will be the actual contents of the child
        var childData = childSnapshot.val();
    });
  });
  </code></pre>
  
  <p>but i have no idea how to use this for my case.
  can anyone please help me??</p>
  
  <p>thank you</p>