• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

SQl query for location

I am wanting to query the database where location = "specific city" and return a list of e-mails. Can anyone help with how to write the query? I'm a clueless SQL user.


XenForo moderator
Staff member
Try this:
SELECT u.email
FROM xf_user as u
LEFT JOIN xf_user_profile AS p ON
(p.user_id = u.user_id)
WHERE p.location = 'London'
Change 'London' to suit.