0

I want to apply query in firebase as "Those Students Who Are Having More Marks Then 70 in tenthP as well as in twelveP" and then show list of their names in list view.

Firebase Database Image

This is I am using query in one child :

DatabaseReference reference = FirebaseDatabase.getInstance().getReference();

            Query query = reference.child("users").orderByChild("tenth").startAt("70").endAt("100");
            query.addListenerForSingleValueEvent(new ValueEventListener() {
                @Override
                public void onDataChange(DataSnapshot dataSnapshot) {
                    if (dataSnapshot.exists()) {
                        Toast.makeText(FilterStudentsActivity.this,"Yes Exist",Toast.LENGTH_LONG).show();
                        // dataSnapshot is the "issue" node with all children with id 0
                        for (DataSnapshot issue : dataSnapshot.getChildren()) {

                        }
                    }
                }

                @Override
                public void onCancelled(DatabaseError databaseError) {

                }
            });
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Cycl0n3
  • 611
  • 1
  • 6
  • 25
  • A Firebase Database query can only sort/filter on a single property. Sometimes it may be possible to combine the values you want to query on into a single (synthesized) property, but that doesn't seem to be the case here. See http://stackoverflow.com/questions/26700924/query-based-on-multiple-where-clauses-in-firebase – Frank van Puffelen Apr 12 '17 at 19:16
  • so there is no technique to filter? – Cycl0n3 Apr 12 '17 at 19:39
  • Not unless someone feels like writing up a way to merge the two numbers into a single value that can be sorted. – Frank van Puffelen Apr 12 '17 at 19:45

0 Answers0