# Segment with filter "email open" not working

**URL:** <https://forum.mautic.org/t/segment-with-filter-email-open-not-working/14629>\
**Category:** Product Support\
**Created:** [June 4, 2020, 10:12am UTC](https://forum.mautic.org/t/segment-with-filter-email-open-not-working/14629 "2020-06-04T10:12:25Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Claude](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/claude/32/1122_2.png) [@Claude](https://forum.mautic.org/u/Claude)\
**Post date:** [June 4, 2020, 10:12am UTC](https://forum.mautic.org/t/segment-with-filter-email-open-not-working/14629/1 "2020-06-04T10:12:25Z")

</div>

**Your software**  
My Mautic version is: 2.16.2  
My PHP version is: 7.2

**Your problem**  
I create a segment that should include all the contacts who have open a specific mail.

However, even if it should have 104 contacts (I can see this number in the statistic of the mail), it stays empty -\> 0 contact.

When I manually enter “php -q console mautic:segments:update” in the console, I get the following error messages:

[Doctrine\DBAL\Exception\InvalidFieldNameException]  
An exception occurred while executing 'SELECT count(leadIdPrimary) count, max(leadIdPrimary) maxId, min(leadIdPrimary) minId F  
ROM (SELECT DISTINCT l.id as leadIdPrimary, iQbuzmtl.lead\_id AS iQbuzmtl\_lead\_id FROM maleads l LEFT JOIN malead\_lists\_leads i  
Qbuzmtl ON iQbuzmtl.lead\_id = l.id and (iQbuzmtl.leadlist\_id = 112) WHERE (EXISTS(SELECT NULL FROM maemail\_stats PzuwTRFM WHER  
E (PzuwTRFM.lead\_id = l.id) AND (email\_stats.is\_read = 1) AND (PzuwTRFM.email\_id IN (?)))) AND (iQbuzmtl.lead\_id IS NULL)) sss  
’ with params [88]:

SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘email\_stats.is\_read’ in ‘where clause’

[Doctrine\DBAL\Driver\PDOException]  
SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘email\_stats.is\_read’ in ‘where clause’

[PDOException]  
SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘email\_stats.is\_read’ in ‘where clause’

Any idea what happens? Everything else is working fine with this mautic installation.

Thanks for your support.

Claude

---

<div class="post-metadata">

**Author:** ![aerendir](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/aerendir/32/1050_2.png) [@aerendir](https://forum.mautic.org/u/aerendir)\
**Post date:** [June 4, 2020, 7:56pm UTC](https://forum.mautic.org/t/segment-with-filter-email-open-not-working/14629/2 "2020-06-04T19:56:35Z")

</div>

Maybe an update went wrong or something else broke your database.

First step is to check if the column exists in the table in the database.

---

<div class="post-metadata">

**Author:** ![Claude](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/claude/32/1122_2.png) [@Claude](https://forum.mautic.org/u/Claude)\
**Post date:** [June 5, 2020, 12:21pm UTC](https://forum.mautic.org/t/segment-with-filter-email-open-not-working/14629/3 "2020-06-05T12:21:45Z")

</div>

Is there a way to re-create the database without loosing the current datas?

---

<div class="post-metadata">

**Author:** ![aerendir](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/aerendir/32/1050_2.png) [@aerendir](https://forum.mautic.org/u/aerendir)\
**Post date:** [June 5, 2020, 2:21pm UTC](https://forum.mautic.org/t/segment-with-filter-email-open-not-working/14629/4 "2020-06-05T14:21:47Z")

</div>

I have no idea: I’ve never tried…

Maybe you can try something like `doctrine:schema:update --force`…

But it is very risky and not guaranteed: if collected data are not complete, I don’t know which will be the behavior of Mautic…

Anyway, if you go this way, do a backup!

---

<div class="post-metadata">

**Author:** ![Claude](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/claude/32/1122_2.png) [@Claude](https://forum.mautic.org/u/Claude)\
**Post date:** [June 7, 2020, 9:44am UTC](https://forum.mautic.org/t/segment-with-filter-email-open-not-working/14629/5 "2020-06-07T09:44:43Z")

</div>

Could I somehow import all the data of the corrupted database into a new mautic installation?

---

<div class="post-metadata">

**Author:** ![aerendir](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/aerendir/32/1050_2.png) [@aerendir](https://forum.mautic.org/u/aerendir)\
**Post date:** [June 8, 2020, 9:37am UTC](https://forum.mautic.org/t/segment-with-filter-email-open-not-working/14629/6 "2020-06-08T09:37:01Z")

</div>

Other than import, I would try to force a schema update: if you have partial data, also importing them in a fresh installation doesn’t solve the problem of incompleteness (if it exists at all).

Also, I think you can only export contacts…

Rebuilding segments, campaigns, emails, etc will be a very hard, long and tedious work.

Do a backup and try to force the update of the schema.

---

<div class="post-metadata">

**Author:** ![Claude](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/claude/32/1122_2.png) [@Claude](https://forum.mautic.org/u/Claude)\
**Post date:** [June 9, 2020, 6:21am UTC](https://forum.mautic.org/t/segment-with-filter-email-open-not-working/14629/7 "2020-06-09T06:21:59Z")

</div>

I forced the schema update… but there is still the same issue and same error messages when I update the segments!

---

<div class="post-metadata">

**Author:** ![aerendir](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/aerendir/32/1050_2.png) [@aerendir](https://forum.mautic.org/u/aerendir)\
**Post date:** [June 18, 2020, 8:35pm UTC](https://forum.mautic.org/t/segment-with-filter-email-open-not-working/14629/8 "2020-06-18T20:35:40Z")

</div>

Check the column exists.

And try to clear the cache.
