[Err] 42000 - [SQL Server]关键字 'from' 附近有语法错误。 求答
selcetvDepartmentID,count(selectcount(*)fromT_EmployeeteinnerjoinT_Salary_Welfare_Oth...
selcet vDepartmentID ,count(select count(*)from T_Employee te inner join T_Salary_Welfare_Other tsw on te.vEmployeeID=(select tsw.tsw_empolyee_id where tsw.tsw_welfare_type='40288a6a5678c616015678d7e2930003') where 1=1) from T_Employee group by vDepartmentID
展开
2个回答
展开全部
一堆的语法错误,逻辑混乱:(
SELECT vDepartmentID
,count(*) AS [部门内享受该福利的人数]
FROM T_Employee te
INNER JOIN T_Salary_Welfare_Other tsw ON te.vEmployeeID = tsw.tsw_empolyee_id
AND tsw.tsw_welfare_type = '40288a6a5678c616015678d7e2930003'
GROUP BY vDepartmentID
展开全部
表面看没看出错误,是不是这句
count(select
tsw.tsw_empolyee_id
where
tsw.tsw_welfare_type='40288a6a5678c616015678dcc2a60010')
我没有这么用过,我们尝试修改下看看,改成下面
sum(case
tsw.tsw_welfare_type
when
'40288a6a5678c616015678dcc2a60010'
then
1
else
0
end)
count(select
tsw.tsw_empolyee_id
where
tsw.tsw_welfare_type='40288a6a5678c616015678dcc2a60010')
我没有这么用过,我们尝试修改下看看,改成下面
sum(case
tsw.tsw_welfare_type
when
'40288a6a5678c616015678dcc2a60010'
then
1
else
0
end)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询