Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!.

like image 239
Deepmala singh M Avatar asked Oct 24 '25 14:10

Deepmala singh M


1 Answers

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/

like image 158
FrankR Avatar answered Oct 26 '25 06:10

FrankR



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!