I have below firebase structure. From this I need to fetch data based on query where Dstatus=ok and Drmoble=mobile no

so far I have written this which is working for a single value only.How can I combine both
mReferenceBooks.orderByChild("Drmoble").equalTo(mobile_no).addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
In firebase realtime database, their is no AND query, which means you can't do:
mReferenceBooks.orderByChild("Drmoble").equalTo(mobile_no).orderByChild("DStatus").equalTo("ok")
To solve this you can create another field that will contain both the DStatus and the Drmoble, for example:
randomId
dstatus-drmoble : "01810000-ok"
Then you can use the following query:
mReferenceBooks.orderByChild("dstatus-drmoble").equalTo("01810000-ok").addValueEventListener(new ValueEventListener() {
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With