2

basically I new to firebase, I just want to that how to retrive specific data from firebase , [firabase](https://i.stack.imgur.com/vk0S6.png[1]

as you can see in above image I want to retrieve like in Sql we use Select CellNum from Student where Email="Adnan@gmail.com. How can I do that in firebase web javascript?

adnan hyder
  • 51
  • 1
  • 6

1 Answers1

5

Try the following:

firebase.database().ref().child("Students").orderByChild("Email").equalTo("Adnan@gmail.com").once("value", function (snapshot) {
  snapshot.forEach(function(childSnapshot) {
    var cellNum=childSnapshot.val().CellNum;
  });
});

The snapshot is at Students, then you loop inside the id 22222 and retrieve the CellNum. The orderByChild is the query where Email="Adnan@gmail.com"

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Peter Haddad
  • 78,874
  • 25
  • 140
  • 134