SELECT COUNT(DISTINCT(id)) AS nb_total_images FROM phpwebgallery_images INNER JOIN phpwebgallery_image_category AS ic ON id = ic.image_id WHERE ((author LIKE '%Piégay%') (author LIKE '% éditeur Givors%')) AND category_id NOT IN (1,2,3,97,95,118) ; [mysql error 1064] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(author LIKE '% éditeur Givors%')) AND category_id NOT IN (1,2,3,9' at line 4