I have come up with this query so far:
SELECT u.username, ufv.field_value FROM xf_user_field_value AS ufv LEFT JOIN xf_user AS u ON (u.user_id = ufv.user_id) WHERE ufv.field_id = 'ggf_s_newsletter';
So far so good, but what I need is a userlist that will return not just the username but also the gender of each user.
And as a second step to make it even more complicated, to return also the value of the "receive site mailings" option.
Any ideas anyone?