# hubdb table query doesn't fetch any rows.

**URL:** <https://community.hubspot.com/t/hubdb-table-query-doesnt-fetch-any-rows/99126>\
**Category:** CMS Development\
**Tags:** hubdb\
**Created:** [January 31, 2024, 5:04pm UTC](https://community.hubspot.com/t/hubdb-table-query-doesnt-fetch-any-rows/99126 "2024-01-31T17:04:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmalone30](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jmalone30/32/39641_2.png) [@jmalone30](https://community.hubspot.com/u/jmalone30)\
**Post date:** [January 31, 2024, 5:04pm UTC](https://community.hubspot.com/t/hubdb-table-query-doesnt-fetch-any-rows/99126/1 "2024-01-31T17:04:57Z")

</div>

I want to fetch the count of all the rows in a table, so here is my statement:

{% set lengthTeam = hubdb\_table\_rows(9999999)|length %}

After executing, lengthTeam is 0. If I add a query, then I get a length \> 0.

i.e : {% set lengthTeam = hubdb\_table\_rows(9999999, “city=Roseville”)|length %}

However, if I use the “ne” comparison operator, I get a length of zero, which I know is invalid. I should get back many rows.

i.e : {% set lengthTeam = hubdb\_table\_rows(9999999, “city\_\_ne=Roseville”)|length %}

Anyone know what’s happening or what I am missing?

---

<div class="post-metadata">

**Author:** ![evaldas](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/evaldas/32/69160_2.png) [@evaldas](https://community.hubspot.com/u/evaldas)\
**Post date:** [February 1, 2024, 5:01pm UTC](https://community.hubspot.com/t/hubdb-table-query-doesnt-fetch-any-rows/99126/2 "2024-02-01T17:01:46Z")

</div>

Hi @jmalone30,

There might be a more direct/elegant solution that I am not aware of, but in order to get the length, you can apply the length filter to the variable:

```lia-code-sample
{% set my_rows = hubdb_table_rows(9999999) %}
{% set lengthTeam = my_rows|length %}

```

Hope this helps!

---

<div class="post-metadata">

**Author:** ![jmalone30](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jmalone30/32/39641_2.png) [@jmalone30](https://community.hubspot.com/u/jmalone30)\
**Post date:** [February 1, 2024, 6:44pm UTC](https://community.hubspot.com/t/hubdb-table-query-doesnt-fetch-any-rows/99126/3 "2024-02-01T18:44:22Z")

</div>

I have tried this also, and still get 0 length. The point is I am fetching 0 records, which is inconceivable!

{% set team = hubdb\_table\_rows(9999999) %}  
{% set lengthTeam = team|length %}  
length team = {{ lengthTeam }}

What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![evaldas](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/evaldas/32/69160_2.png) [@evaldas](https://community.hubspot.com/u/evaldas)\
**Post date:** [February 1, 2024, 6:57pm UTC](https://community.hubspot.com/t/hubdb-table-query-doesnt-fetch-any-rows/99126/4 "2024-02-01T18:57:31Z")

</div>

That’s odd.

Are you seeing anything returned from the {{ team }} variable?

```lia-code-sample
{% set team = hubdb_table_rows(9999999) %}
{% set lengthTeam = team|length %}

<p>lengthTeam = {{ lengthTeam }}</p>

<p>team = {{ team }}</p>

```

---

<div class="post-metadata">

**Author:** ![jmalone30](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jmalone30/32/39641_2.png) [@jmalone30](https://community.hubspot.com/u/jmalone30)\
**Post date:** [February 1, 2024, 7:04pm UTC](https://community.hubspot.com/t/hubdb-table-query-doesnt-fetch-any-rows/99126/5 "2024-02-01T19:04:13Z")

</div>

No, but if I query the same table with a filter, I do get results back. But none of the comparison operators work.

This works:

{% set query = “orderBy=-hs\_created\_at” ~ “&city=Roseville” %}

{% set team= hubdb\_table\_rows(9999999, query) %}

This does not work:

{% set query = “orderBy=-hs\_created\_at” ~ “&city\_\_ne=Roseville” %}

{% set team= hubdb\_table\_rows(9999999, query) %}

and, as I said before, this does not work:

{% set team= hubdb\_table\_rows(9999999) %}

---

<div class="post-metadata">

**Author:** ![jmalone30](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jmalone30/32/39641_2.png) [@jmalone30](https://community.hubspot.com/u/jmalone30)\
**Post date:** [February 1, 2024, 7:16pm UTC](https://community.hubspot.com/t/hubdb-table-query-doesnt-fetch-any-rows/99126/6 "2024-02-01T19:16:40Z")

</div>

I think I figured this out! I wasn’t familiar with using debug mode when rendering the page. Once I turned it on, I see this error:

TemplateError{severity=WARNING, reason=OVER\_LIMIT, item=FUNCTION, message=‘Page is over hubdb\_table\_rows call limit of 10. **Result from hubdb\_table\_rows will be empty.** ’

So I need to re-examine the page to reduce the hubdb\_table\_rows calls.
