# Queries through Related Tables

**URL:** <https://community.dreamfactory.com/t/queries-through-related-tables/76>\
**Category:** Schema & Data\
**Created:** [May 29, 2014, 8:00pm UTC](https://community.dreamfactory.com/t/queries-through-related-tables/76 "2014-05-29T20:00:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/mark/32/69_2.png) [@Mark](https://community.dreamfactory.com/u/Mark)\
**Post date:** [May 29, 2014, 8:00pm UTC](https://community.dreamfactory.com/t/queries-through-related-tables/76/1 "2014-05-29T20:00:23Z")

</div>

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!
