В чем ошибка запроса - никак найти не могу?

Рейтинг: 0Ответов: 1Опубликовано: 23.12.2014
SELECT thematicspecialization.idSpecialization, thematicspecialization.SpecializationName AS SpecializationName, COUNT(ac.article_categoryIdCatgory) AS CNT

FROM thematicspecialization
LEFT JOIN( SELECT article_category.article_categoryIdCatgory
          FROM article_category
          JOIN article ON (article.idArticle = article_category.article_categoryIdArticle AND article.country = 112)) ac

#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 'LIMIT 0, 30' at line 7

Другой вариант этого же запроса:

SELECT idSpecialization, 
   thematicspecialization.SpecializationName AS SpecializationName,  
   COUNT(article_categoryId) AS CNT
FROM thematicspecialization
   LEFT JOIN article_category ON article_category.article_categoryIdCatgory =     thematicspecialization.idSpecialization
   JOIN article ON (article.idArticle = article_category.article_categoryIdArticle AND article.country = 100)
       GROUP BY idSpecialization

но в нем не срабатывает article.country = 100

Ответы

▲ 2Принят

Нет условия соединения (ON) таблицы thematicspecialization и подзапроса ac.