SELECT
    COUNT(*) AS `count`
FROM
    calendar
WHERE
    attendance_preference != 1
AND calendar.date BETWEEN "%s" AND "%s"
AND calendar.date NOT IN("%s")
AND DAYOFWEEK(calendar.date) != 1
LIMIT 1
;