title: Cannot Perform Multiple Queries On Firebase Database to Display in RecyclerView
body: <p>I am trying to query the most recent children in my Firebase database and then sort that limit of recent children by a child value. I understand that the Cloud Firestore has recently been released, and that querying features continue to evolve on the Firebase Realtime Database as well.</p>
  
  <p>I am using the FirebaseUI FirebaseRecyclerAdapter, and within that adapter you must enter a query. I am tweaking to add 2 queries to my RecyclerView. I am doing so as follows:</p>
  
  <pre><code>mFireAdapter = new FirebaseRecyclerAdapter&lt;Poll, PollHolder&gt;(
      Poll.class, R.layout.latest_item, PollHolder.class, 
      mBaseRef.child("Polls").limitToLast(3).orderByChild("vote_count"))
  </code></pre>
  
  <p>Unfortunately, it is not working, as it is first ordering the <strong>whole</strong> database by the child value and then displaying those 5 values. Essentially, the result is flipped in terms of what I am seeking: I want to query by limiting to the most recent X children and THEN sort those by child value. Any ideas where I am going wrong?</p>
  
  <p>Edit:</p>
  
  <p>Here is my Firebase Database. Essentially, I want to limit the query to the last 3 items in that database, and then sort those 3 items by vote count. I then want them to populate the RecyclerView accordingly. I am trying to do that in the code snippet listed above, but instead of actually limiting to the last 3 items in the database it is querying the whole database.</p>
  
  <p><a href="https://i.stack.imgur.com/tx8kZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tx8kZ.png" alt="enter image description here"></a></p>