Deepmala singh M
Deepmala singh M

Reputation: 399

How to join three tables in Firebase Realtime Database?

I have to join three tables in Firebase to fetching the value from it. consider three table A,B, C.Table A contains attribute as(id1,name).Table B contains attribute as(id2,Bname).C contains attribute as(id1,id2).the relation between table A and table B is M to M. I want this query to executed in Firebase.
the query is
select A.id1 from A,B,C where A.id1=C.id1 and B.id2=C.id2 and B.Bname="?"

Thank You!.

Upvotes: 4

Views: 2694

Answers (1)

FrankR
FrankR

Reputation: 206

The Firebase Realtime database is not like an sql database, it has no idea of joins etc. References are fairly cheap, so maybe create 3 references to the 3 locations that contain the data and run these 3 "queries" and tie the results together to get the final view of the data you want. Something like RxJava might help in running the 3 "queries" and chaining the results together.

Try joining the Firebase Slack channel, it has a lot of good posts on how to structure your Firebase data etc.

https://firebase.community/

Upvotes: 3

Related Questions