我在此查询中遇到错误。我不知道它有什么问题。帮助将不胜感激。
SELECT Email, UserID, FirstName, LastName,
count(*) as userTextCount FROM user LEFT JOIN posts ON posts.PostedAsId = user.UserID and
PostedAs = 'USER' and PostType = 'text',
count(*) as userMediaCount FROM user LEFT JOIN posts ON posts.PostedAsId = user.UserID and
PostedAs = 'USER' and PostType = 'media'
WHERE 1
GROUP BY Email, UserID, FirstName, LastName
错误:
#1064 - You have an error in your SQL syntax;
MySQL server version for the right syntax to use near 'count(*) as userMediaCount FROM
user LEFT JOIN posts ON posts.PostedAsId = user.' at line 3
用户表包含:Email、UserId、FirstName、LastName 和帖子表包含所有帖子,我需要按特定用户计算帖子。
谢谢。