-- stat du jour
SELECT t.dayNumber, count(*), count(DISTINCT p.id)
FROM `fostt_participants` p
INNER JOIN fostt_participants_timeslots ON participant_id = p.id
INNER JOIN fostt_timeslots t ON timeslot_id = t.id
WHERE p.`event_id` = 184
GROUP BY t.dayNumber
UNION
SELECT -1, count(*), count(DISTINCT p.id)
FROM `fostt_participants` p
INNER JOIN fostt_participants_timeslots ON participant_id = p.id
INNER JOIN fostt_timeslots t ON timeslot_id = t.id
WHERE p.`event_id` = 184;

-- mail de rappel
SELECT DISTINCT u.email
FROM `fostt_users` u
WHERE EXISTS (SELECT 1
              FROM `fostt_participants` p
				INNER JOIN fostt_participants_timeslots ON participant_id = p.id
				INNER JOIN fostt_timeslots t ON timeslot_id = t.id
              WHERE u.id = p.user_id 
                AND p.`event_id` = 133
                AND t.dayNumber = 1)
AND NOT EXISTS (SELECT 1
              FROM `fostt_participants` p
				INNER JOIN fostt_participants_timeslots ON participant_id = p.id
				INNER JOIN fostt_timeslots t ON timeslot_id = t.id
              WHERE u.id = p.user_id 
                AND p.`event_id` = 133
                AND t.dayNumber = 2);

-- galère de saisie ?
SELECT count(*) 
FROM `fostt_participants` p
	INNER JOIN `fostt_users` u ON p.user_id = u.id
WHERE `event_id` = 133
AND NOT EXISTS (SELECT 1 FROM fostt_participants_timeslots WHERE participant_id = p.id);


SELECT *
FROM `fostt_users` u
WHERE NOT EXISTS (SELECT 1 
				  FROM `fostt_participants` p
					INNER JOIN fostt_participants_timeslots ON participant_id = p.id
				   WHERE p.`event_id` = 133	);
