# A query for users with a custom title?

**URL:** <https://meta.discourse.org/t/a-query-for-users-with-a-custom-title/275004>\
**Category:** Data & reporting\
**Tags:** sql-query\
**Created:** [October 14, 2016, 8:50pm UTC](https://meta.discourse.org/t/a-query-for-users-with-a-custom-title/275004 "2016-10-14T20:50:11Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)\
**Post date:** [October 15, 2016, 5:30pm UTC](https://meta.discourse.org/t/a-query-for-users-with-a-custom-title/275004/3 "2016-10-15T17:30:40Z")

</div>

Thanks @fefrei, that seems to work, but as you mentioned it might not cover all the edge cases. I did have to change the first line ` SELECT title FROM users` to `SELECT username FROM users` as I was looking for the usernames, not the custom titles.

@Mittineague was able to create a query that seems to work as well

```sql
SELECT 
users.username
, users.title 
FROM users 
JOIN user_profiles 
ON user_profiles.user_id = users.id 
WHERE users.title IS NOT NULL 
AND users.title NOT LIKE '' 
AND user_profiles.badge_granted_title IS NOT TRUE

```

---

_[View the full topic](https://meta.discourse.org/t/a-query-for-users-with-a-custom-title/275004)._
