title: Retrieve count data from Firebase like MySQL
body: <p>When trying to pull data from a MySQL database, I can do something like:</p>
  
  <p><code>SELECT * FROM users ORDER BY id WHERE vehicle = car</code></p>
  
  <p>That should get me all the users that drives a car and not show users that drives a motorcycle for instance.</p>
  
  <p>Is there something like this for Firebase? I can only retrieve specific data from one user?</p>
  
  <p>My firebase database is like this: user -> user info (name, age, vehicle etc..)</p>
  
  <p>I want to query every user that drives a car and display them in a row. How do I do that?</p>
  
  <hr>
  
  <p>I have tried the following, but I didn't succeed with what I tried to do, since after <code>users</code> the users id is the next child. Is there a way to query past that?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var recents = firebase.database().child('users').orderByChild('department').equalTo(department);
              recents.on('child_added', function(snapshot) {
              var countOfUserInDepartment = snapshot.count;
              
                  document.querySelector("#cphCount").innerHTML = countOfUserInDepartment;
              
              });</code></pre>
  </div>
  </div>
  </p>