---
title: Filtering Related Columns within DreamFactory REST API Queries
description: Filtering related records when joining tables using DreamFactory REST API queries is simple and convenient. See how to join related tables below.
---

[Blog](https://blog.dreamfactory.com)

# [Filtering Related Columns within DreamFactory REST API Queries](https://blog.dreamfactory.com/filtering-related-columns-within-dreamfactory-rest-api-queries)

 Written by [Jason Gilmore](https://blog.dreamfactory.com/author/jason-gilmore) | January 19, 2026

Consider a query which joins employee records found in an employees table with information about their assigned department, the latter of which resides in a table named departments. The relationship is formalized using a key named `emp_no`. When DreamFactory parses the schema it will create aliases for each relationship, including one for the above-described named something like `dept_emp_by_emp_no`. The join query will therefore look like this:

```
/api/v2/mysql/_table/employees?related=dept_emp_by_emp_no
```

This would yield a JSON response containing records that look like this:

```
{
  "emp_no": 10001,
  "birth_date": "1953-09-02",
  "first_name": "Georgi",
  "last_name": "Facello",
  "gender": "M",
  "hire_date": "1986-06-26",
  "birth_year": "1953",
  "dept_emp_by_emp_no": [
    {
      "emp_no": 10001,
      "dept_no": "d005",
      "from_date": "1986-06-26",
      "to_date": "9999-01-01"
    }
  ]
},
```

If you wanted to limit the related fields to just `dept_no` and `from_date`, you would add `dept_emp_by_emp_no.fields` to the parameter list:

```
/api/v2/mysql/_table/employees?related=dept_emp_by_emp_no&amp;dept_emp_by_emp_no.fields=dept_no,from_date
```

This query would yield records with the following structure:

```
{
  "emp_no": 10001,
  "birth_date": "1953-09-02",
  "first_name": "Georgi",
  "last_name": "Facello",
  "gender": "M",
  "hire_date": "1986-06-26",
  "birth_year": "1953",
  "dept_emp_by_emp_no": [
    {
      "dept_no": "d005",
      "from_date": "1986-06-26"
    }
  ]
},
```

You can learn more about working with related data inside DreamFactory on our wiki: [https://wiki.dreamfactory.com/DreamFactory/Features/Database/Related\_Data#Getting\_the\_Related\_Data](https://wiki.dreamfactory.com/DreamFactory/Features/Database/Related_Data#Getting_the_Related_Data).

Related reading: [Building the Reusable REST API Platform Strategy](https://blog.dreamfactory.com/the-reusable-rest-api-platform-strategy/)

[View full post](https://blog.dreamfactory.com/filtering-related-columns-within-dreamfactory-rest-api-queries)

```json
{
  "@context" : "http://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Jason Gilmore"
  },
  "dateModified" : "2026-05-15T01:06:21.166Z",
  "datePublished" : "2026-01-19T00:00:00Z",
  "headline" : "Filtering Related Columns within DreamFactory REST API Queries",
  "image" : {
    "@type" : "ImageObject",
    "height" : 60,
    "url" : "/hs/hsstatic/content_shared_assets/static-1.4092/img/default-amp-logo.png",
    "width" : 60
  },
  "mainEntityOfPage" : "https://blog.dreamfactory.com/filtering-related-columns-within-dreamfactory-rest-api-queries",
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "height" : 60.0,
      "url" : "https://44870387.fs1.hubspotusercontent-na1.net/hubfs/44870387/LOGO%20(500%20x%20500%20px).ico",
      "width" : 60.0
    },
    "name" : "Blog"
  }
}
```