My data structure looks like:
Database
Data1 {
Family: "Adam, John, Smith, Bob, Alice"
Age: "12, 23, 6, 5, 8"
Area: "GT6, GT9, GT12"
}
Data2 {
Family: "Tom, Ben, Berry, Hosh, Nico"
Age: "68, 43, 26, 15, 18"
Area: "67D, HG6, DHJD, 453"
}
Data3 {
Family: "Alice, Karan, faser, jenny, kietty"
Age: "14, 10, 15, 17, 5"
Area: "HG6, 67D, DHJD"
}
I want to only print / retrieve data that contains for example Area "67D", in this I want to print all data from data 2 and 3.
Please let me know if my question is not clear.
I have tried
Query queryRef = ref.orderByChild("Area").equalTo("67D");
queryRef.addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot snapshot, String previousChild) {
System.out.println(snapshot.getKey());
}
// ....
});