Retrieve A knowing B in A-AB-B usnig a single query

How can i actualy do that?

I have table of users and teble of events, they are connected through user-event table. So how can i get list of user that have user-event connection knowing only event?

Hi Artyom,

Why don’t you just relate Users table to Events table? There will be no need for the third table.

Because I need info about every relation, like in user-relation table I have status column

Try referring to this documentation section: https://backendless.com/documentation/data/android/data_relations_retrieve.htm

I’ve been reading this arcticle over and over for 4-5 hours. Still cant handle this

The whereClause should be like the following:

UserEvent[event].objectId='eventId'

and then request the users with this method:

Backendless.Data.of( BackendlessUser.class ).find( query );

It says incvalid where clause, cause there is no direct relation between users and events, only throug event-user table

This where clause does not assume that there is such direct relation, it assumes that:

  1. UserEvent relates to Users table
  2. UserEvent relates to Events table through event column

Then, if I use your method i will find only one user, couse each relation specified one eventId. But I need to find them all, without having to many querys

Then try this:

UserEvent[event].objectId IS NOT NULL