List of emails of users watching a specific category

I have a Data Explorer query that runs this:

SELECT * FROM category_users WHERE category_id = '10'

This gives me a result that looks like this:

How can I also display the users’ email in this output?

(To forestall privacy discussions let me note the following: we use a private Discourse for paying members, who have individually given consent to our use of their personal information for the purposes of delivering services to them. We have systems that don’t interoperate in an automated fashion and we use emails to manually connect the users in two different systems.)

You need to join the user_emails table based on the user_id from the category_users table. Give something like this a try:

SELECT
cu.*,
ue.email
FROM category_users cu
JOIN user_emails ue
ON ue.user_id = cu.user_id
WHERE category_id = '10'
AND ue.primary = true