Query:
SELECT
loc_countries.*,
loc_countries.Title AS Title,
loc_countries.StrId AS StrId,
img.Id AS ImgId,
CONCAT( '/attachment/', IF( img.DirectoryPath IS NULL, '', CONCAT( img.DirectoryPath, '/' ) ), img.Id, '_', img.FileName ) AS ImgPath,
img.Name AS ImgName
FROM
loc_countries
LEFT JOIN loc_country_image ON loc_country_image.CountryId = loc_countries.Id
LEFT JOIN attachments AS img ON img.ParentId = loc_country_image.AttachmentId AND img.CopyId = 1
WHERE
loc_countries.Deleted IS NULL
AND
loc_countries.Id IN (SELECT CountryId FROM loc_country_month WHERE MonthId=)
GROUP BY
loc_countries.Id
ORDER BY
loc_countries.Title ASC
failed. You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')
GROUP BY
loc_countries.Id
ORDE...' at line 20