Queries through Related Tables

Let’s take a quick look into an example of two tables: Cinemas and Addresses

The following scenario assumes that the two tables have been properly configured to relate data to one another during schema creation!

Let’s assume Cinemas is the parent table and Addresses is the child table.

Each Cinema can have any number of related Addresses.

The Addresses table has a column named “CinemaId”.

To get all Cinemas that have an Address where state=CA you could make the following query.

GET /rest/db/Addresses?related=Cinemas_by_CinemaId&filter=state='CA'

It’s a good idea to escape filter string to state%3D’CA’.

In the results each Addresses record that matched the query will contain the parent Cinemas record as an object named Cinemas_by_CinemaId.

Thanks!