# How to filter HubDB data with foreign table

**URL:** <https://community.hubspot.com/t/how-to-filter-hubdb-data-with-foreign-table/22442>\
**Category:** CMS Development\
**Tags:** hubdb\
**Created:** [July 3, 2020, 5:21am UTC](https://community.hubspot.com/t/how-to-filter-hubdb-data-with-foreign-table/22442 "2020-07-03T05:21:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hubmonks](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/hubmonks/32/35608_2.png) [@Hubmonks](https://community.hubspot.com/u/Hubmonks)\
**Post date:** [July 3, 2020, 5:21am UTC](https://community.hubspot.com/t/how-to-filter-hubdb-data-with-foreign-table/22442/1 "2020-07-03T05:21:55Z")

</div>

I’ve 3 tables in HubDB. One is main table and other tables are foregin table. I want to filter the data based on the column of foregin table.

There is not anything related to foregin table in HubDB Filter API documentation.

---

<div class="post-metadata">

**Author:** ![piersg](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/piersg/32/99782_2.png) [@piersg](https://community.hubspot.com/u/piersg)\
**Post date:** [July 3, 2020, 3:13pm UTC](https://community.hubspot.com/t/how-to-filter-hubdb-data-with-foreign-table/22442/2 "2020-07-03T15:13:43Z")

</div>

Hi @Hubmonks, I haven’t tested this myself, but I think this would work:

`{% set child_table_columns = hubdb_table_column(dynamic_page_hubdb_row.hs_child_table_id) %}{% for column in child_table_columns %} // do stuff with the data e.g. {% if column.title == 'xyz' %} {% endif %}{% endfor %}`
