MySQL sum(),count()组合用法

SELECT SUM(b.clickCount)
FROM
(
 SELECT COUNT(cac.article_id) as clickCount
 from 
 (
SELECT ca.id as articleId,
article_title as articleTitle,
csu.user_account as userAccount
FROM car_article ca
join car_sys_user csu on ca.user_id = csu.id
WHERE ca.`status`="1" and ca.user_id = 1 
)a
JOIN car_article_click cac on a.articleId = cac.article_id
GROUP BY cac.article_id )b

你可能感兴趣的:(mysql,JAVAEE期末项目)