# Data explorer doesn't show email address with a where clause

**URL:** https://meta.discourse.org/t/data-explorer-doesnt-show-email-address-with-a-where-clause/70460
**Category:** Bug
**Created:** [20. September 2017 um 16:15 UTC](https://meta.discourse.org/t/data-explorer-doesnt-show-email-address-with-a-where-clause/70460 "2017-09-20T16:15:46Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![awlogan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awlogan/32/62208_2.png) [@awlogan](https://meta.discourse.org/u/awlogan)
#### Post date: [20. September 2017 um 16:15 UTC](https://meta.discourse.org/t/data-explorer-doesnt-show-email-address-with-a-where-clause/70460/1 "2017-09-20T16:15:46Z")

</div>

I’m trying to run a [data explorer](https://meta.discourse.org/t/32566?silent=true) query to allow me to collect email addresses of the users signing up for our community. The primary goal here is to try to find out if they are a customer or partner of our company, assuming that they didn’t use a personal email address, then I can add them to the appropriate group.

The problem I’m having is that with a where clause in my query I get NULL returned on the email address in most cases. Here is the query I’m running:

```
SELECT u.username AS "username", u.email
FROM users u
WHERE u.created_at > '2017-09-11'

```

If I run this I get the NULL for email but otherwise it works. I read through the original [data explorer](https://meta.discourse.org/t/32566?silent=true) thread and saw an example using user ID, which works if I set it to 0 in my where clause like this:

```
SELECT u.username AS "username", u.email
FROM users u
WHERE u.id > 0

```

This works as expected. But if I change it to be above a certain value, in my case the last user to sign up before we opened the community up was 384, I get the same NULL values for email:

```
SELECT u.username AS "username", u.email
FROM users u
WHERE u.id > 384

```

It feels like this is a bug as I wouldn’t expect the where clause to cause email addresses not to be shown, but it also seems to work inconsistently. I’m on a Discourse hosted account if that helps troubleshoot things.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [20. September 2017 um 16:23 UTC](https://meta.discourse.org/t/data-explorer-doesnt-show-email-address-with-a-where-clause/70460/2 "2017-09-20T16:23:22Z")

</div>

Emails have been split out to their own table. Use the schema lookup on the right to find user\_emails.

---

<div class="post-metadata">

### Author: ![awlogan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awlogan/32/62208_2.png) [@awlogan](https://meta.discourse.org/u/awlogan)
#### Post date: [20. September 2017 um 16:27 UTC](https://meta.discourse.org/t/data-explorer-doesnt-show-email-address-with-a-where-clause/70460/3 "2017-09-20T16:27:52Z")

</div>

I did look through that, but why does it work sometimes and not others? Maybe it was changed after I started using it and those are legacy entries?

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [20. September 2017 um 16:30 UTC](https://meta.discourse.org/t/data-explorer-doesnt-show-email-address-with-a-where-clause/70460/4 "2017-09-20T16:30:06Z")

</div>

That’s exactly right. New users aren’t getting the column filled out, but it’s not deleted because not all the code has been updated yet.

---

<div class="post-metadata">

### Author: ![awlogan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awlogan/32/62208_2.png) [@awlogan](https://meta.discourse.org/u/awlogan)
#### Post date: [20. September 2017 um 16:33 UTC](https://meta.discourse.org/t/data-explorer-doesnt-show-email-address-with-a-where-clause/70460/5 "2017-09-20T16:33:55Z")

</div>

OK thanks, that makes sense. I’ll work out the new table, thanks for the quick response.

---

<div class="post-metadata">

### Author: ![HAWK](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hawk/32/86627_2.png) [@HAWK](https://meta.discourse.org/u/HAWK)
#### Post date: [20. September 2017 um 16:39 UTC](https://meta.discourse.org/t/data-explorer-doesnt-show-email-address-with-a-where-clause/70460/6 "2017-09-20T16:39:13Z")

</div>


