我正在使用以下 Select 语句来检索和计算多个表中每个字段的总数。但是,在执行语句时,我收到错误“在单词连接处或附近出现语法错误”
任何帮助将不胜感激
询问:
Select CompanyStatus,Companyname,
INNER JOIN Company on usersincompany.companyID=company.companyID,
INNER JOIN company on users.companyID=Company.companyID,
INNER JOIN usersincompany on users.userid=usersincompany.userid,
INNER JOIN users on userstatus.userstatudid=users.userstatusid,
INNER JOIN users on project.companyid=users.companyid,
INNER JOIN users on usersession.userid=users.userid,
INNER JOIN project on template.projectid=project.projectid,
INNER JOIN project on merchendisingarea.projectid=project.projectid,
INNER JOIN merchendisingarea on publishstatus.publishstatusid=merchendisingarea.publishstatusid,
INNER JOIN template on merchendisingmodule.templateid=template.templateid,
INNER JOIN company on companyaccountclassification.classificationtypeid=company.classificationtypeid,
sum(distinct users.userid) as TotalUsers,
sum(case when users.userstatusid =2 then 1 else 0 end) as Activeusers,
sum(case when users.userstatusid =3 then 1 else 0 end) as SuspendedUsers,
sum(distinct usersessionid) as TotalLogin,
sum(distinct merchendisingmoduleid) as CurrentModules,
count( merchendisingmodule.createddate) as Modulescreated,
count( merchendisingmodule.updateddate) as Modulesupdated,
sum(distinct merchendisingareaid) as Currentareas,
count( merchendisingarea.createddate) as AreasCreated,
count( merchendisingarea.updateddate) as Areasupdated,
sum(case when publishingstatus.publishstatusid =1 then 1 else 0 end) as SuccessPublished,
sum(case when publishingstatus.publishstatusid =3 then 1 else 0 end) as FailedPublished
from users,company,merchendisingmodule,merchendisingarea,publishingstatus, usersession group by companystatus, companyname