SELECT COUNT(DISTINCT(id))
  FROM phpwebgallery_image_category AS ic
    INNER JOIN phpwebgallery_comments AS com
    ON ic.image_id = com.image_id
  WHERE validated = 'true'
    AND date > SUBDATE(CURDATE(), INTERVAL 1 DAY)
    AND 1=1
    AND 1=1
    AND 1=1
    AND category_id NOT IN (-1)
;
[mysql error 1146] Table 'sncf_ratp.phpwebgallery_comments' doesn't exist