# Filtering data in Hubdb tables

**URL:** <https://community.hubspot.com/t/filtering-data-in-hubdb-tables/50851>\
**Category:** CMS Development\
**Tags:** hubdb\
**Created:** [February 3, 2022, 3:25pm UTC](https://community.hubspot.com/t/filtering-data-in-hubdb-tables/50851 "2022-02-03T15:25:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChrisChiha](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/chrischiha/32/90510_2.png) [@ChrisChiha](https://community.hubspot.com/u/ChrisChiha)\
**Post date:** [February 3, 2022, 3:25pm UTC](https://community.hubspot.com/t/filtering-data-in-hubdb-tables/50851/1 "2022-02-03T15:25:17Z")

</div>

Hello,  
I am currently fetching data from my hubdb into my emails. however i would like to filter the displayed data based on a column in the Hubdb.

I just went through this documentation on filtering displayed data from HubDB with repect to a certain column : [Accounts Dashboard | HubSpot](https://developers.hubspot.com/docs/api/cms/hubdb#filter-returned-rows)

However i am not able to filter data, as i believe i am misusing this line of code in my current template.  
Noting: my code is successfully fetching everything from hudb and displaying it in the email, i just want to filter with respect to a column “email” in my hubdb table.  
My Code:  
{% set rows = hubdb\_table\_rows(5294924) %}  
{% if rows|length %}  
{% for row in rows %}  
{% set query = “email\_\_contains=”~contact.email %}

I would really appreciate some help on how to use the filter line of code in my existing coded template to display rows that meet this criteria as this is top priority for me.

---

<div class="post-metadata">

**Author:** ![Brownstephen101](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/brownstephen101/32/52735_2.png) [@Brownstephen101](https://community.hubspot.com/u/Brownstephen101)\
**Post date:** [February 3, 2022, 8:51pm UTC](https://community.hubspot.com/t/filtering-data-in-hubdb-tables/50851/2 "2022-02-03T20:51:03Z")

</div>

Hi @ChrisChiha , you need to reference your query when you set your hubdb table row, like this:

`{% set query = "email__contains="~contact.email %}{% set rows = hubdb_table_rows(5294924, query) %}{% if rows|length %}{% for row in rows %}{% endfor %}{% endif %}`

Hope that helps.
