Support Topics Documentation Slack YouTube Blog

Get parents for all children

Hello
I have Table Album and table Pictures.
I want to get all pictures who is older than 1 day along with the Album it belongs to.

Is it possible in one Query? If not, do I do a circular relationship?
Thank you

Hi!
What is the current relationship between Album and Pictures tables?

Hi Sofia
The current relationship is 1:N

So one album has many pictures.

If you want to get list of Picture-objects along with Album-objects it would be better to perform two actions - get the list of Pictures older than 1 day and after retrieve list of Albums depending on list of selected Pictures.

Thank you. How can I perform the second action ? Or do you mean I iterate through pictures and for each object Id, I get album?
Thanks

Check this https://backendless.com/docs/android/data_search_with_where_clause.html
you can use IN ('value1', 'value2', 'value3) for whereClause.

I would recommend to use such form of where clause to make request for table photo:

album[rel_photo].objectId = '814FF3D9-9A9B-2006-FF03-C1A2CDCFFF00'
where:
album – table
rel_photo – column name, that is relation 1:N to the table photo
objectId – object id of an particular album in the same name table

The result will be a list of photos in your album.