标题:在应使用条件的上下文(在 ')' 附近)中指定了非布尔类型的表达式
取消只看楼主
任我走
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2021-4-16
 问题点数:0 回复次数:0 
在应使用条件的上下文(在 ')' 附近)中指定了非布尔类型的表达式
SELECT TOP 1048575 "dbo"."employee_all"."rno" AS "rno", "dbo"."employee_all"."rname" AS "rname",
"dbo"."employee_all"."sex" AS "sex", "dbo"."employee_all"."checkdate" AS "checkdate",
"dbo"."employee_all"."outdate" AS "outdate", "dbo"."employee_all"."staus" AS "staus",
"Hrt Department"."remark" AS "Hrt Department__remark"
FROM "dbo"."employee_all"
LEFT JOIN "dbo"."HRT_DEPARTMENT" "Hrt Department" ON "dbo"."employee_all"."depno" = "Hrt Department"."depno"
where (select distinct top 100 percent CONVERT (varchar(7),checkdate,120)'日期',sum(case when CONVERT (varchar(7),checkdate,120) >='2021-01' then 1 end )'入职',b.lz '离职' from employee_all a
left join
(select distinct convert (varchar(7),outdate,120) rq ,sum(case when outdate >0  then 1 else 0 end) lz from employee_all
where CONVERT (varchar(7),outdate,120) >='2021-01' group by convert (varchar(7),outdate,120)) b on b.rq=CONVERT (varchar(7),a.checkdate,120)
 where CONVERT (varchar(7),checkdate,120) >='2021-01'
group by CONVERT (varchar(7),checkdate,120) ,b.lz order by CONVERT (varchar(7),checkdate,120))
SQL新手,求教
搜索更多相关主题的帖子: SELECT FROM 条件 varchar CONVERT 
2021-04-16 14:23



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-505470-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.107741 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved