Topic: problem nesting subqueries into a query

I can't figure out how to translate this query into ruby :

SELECT count(distinct usermail) FROM stats where festivalId='2013' 

and usermail in (select usermail from stats where typeActivity='checkins')

and usermail in (select usermail from stats where typeActivity='programs')

and usermail in (select usermail from stats where typeActivity='status')

and usermail in  (select usermail from stats where typeActivity='pictureUpload');

i don't know how to nest queries into a big one, please help!!