<p>It's basically the same as <a href="https://craftcms.stackexchange.com/a/27297/5557">Find entries that use a specific block in their Matrix field?</a></p>

<p>You can use the base query and left join your Super Table content row</p>

<pre class="lang-twig prettyprint-override"><code>{% set entries = craft
    .entries()
    .section(['your-section'])
    .leftJoin('{{%supertableblocks}} as supertableblocks', '[[supertableblocks.ownerId]] = [[entries.id]]')
    .leftJoin('{{%stc_content}} as stc_content', '[[stc_content.elementId]] = [[supertableblocks.id]]')
    .andWhere(['&gt;=', 'stc_content.field_date', entry.date|date('atom')]) 
    .groupBy('supertableblocks.ownerId')
    .all()
%}
</code></pre>

<p>Note: this is untested, maybe you need certain modifications it should just be some kind of guidance. Please keep in mind to replace your actual table and field names. I just used <code>stc_content</code> as a demonstration as well as <code>stc_content.field_date</code></p>

CC BY-SA 4.0
2018-08-20T08:57:46.167Z
great thank you, I had not seen the tables created by the plugin.
Thanks it works now
Patrick Faramaz
CC BY-SA 4.0
2019-12-01T01:24:32.127Z
I get a SQL error when setting `groupBy` that says it's incompatible with MySql 5.7's `sql_mode=only_full_group_by` setting. Any way to modify to avoid the error?
kmgdev
CC BY-SA 4.0
2018-08-17T16:31:11.397Z
2018-08-17T16:31:11.397Z
Robin Schambach
<p>I have a section with a <a href="https://verbb.io/craft-plugins/super-table/features" rel="nofollow noreferrer">Super Table</a> field, each &quot;row&quot; of which contains a date field. I am looking for a way to query for entries where one of the rows contains a future date.</p>

CC BY-SA 4.0
2021-11-18T09:18:56.673Z
The solution of the previous comment did workout for me, just notice that the blocks should be called like this: stc_XXX field_XXX
HairyMike
<craft3><plugin-supertable>
Entries query by Super Table field
# Entries query by Super Table field

(Asked by: username_0 on 2018-08-17)

I have a section with a [Super Table](https://verbb.io/craft-plugins/super-table/features) field, each "row" of which contains a date field. I am looking for a way to query for entries where one of the rows contains a future date.

**Tags:** craft3, plugin-supertable
> **Comments:**
> **username_1**: The solution of the previous comment did workout for me, just notice that the blocks should be called like this: stc_XXX field_XXX  

---

## 1 answers

### Answer by username_2 on 2018-08-17. Score: 3 | Accepted answer

It's basically the same as Find entries that use a specific block in their Matrix field?
You can use the base query and left join your Super Table content row
{% set entries = craft
    .entries()
    .section(['your-section'])
    .leftJoin('{{%supertableblocks}} as supertableblocks', '[[supertableblocks.ownerId]] = [[entries.id]]')
    .leftJoin('{{%stc_content}} as stc_content', '[[stc_content.elementId]] = [[supertableblocks.id]]')
    .andWhere(['>=', 'stc_content.field_date', entry.date|date('atom')]) 
    .groupBy('supertableblocks.ownerId')
    .all()
%}

Note: this is untested, maybe you need certain modifications it should just be some kind of guidance. Please keep in mind to replace your actual table and field names. I just used stc_content as a demonstration as well as stc_content.field_date

> **Comments:**
> **username_0**: great thank you, I had not seen the tables created by the plugin. Thanks it works now  
> **username_3**: I get a SQL error when setting `groupBy` that says it's incompatible with MySql 5.7's `sql_mode=only_full_group_by` setting. Any way to modify to avoid the error?  

---

