添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
谈吐大方的筷子  ·  self.lstm = ...·  6 月前    · 
任性的紫菜  ·  Azure Data Factory ...·  1 年前    · 
爽快的凉茶  ·  javascript - TS ...·  1 年前    · 

SQL Server]关键字 'CASE' 附近有语法错误

SELECT

(select count(*) from hocm_project where work_status='在建' and org_id in (

SELECT id from sys_org where parent_id ='16b2a96f9b04428f8f9aca3b04b947e0' ))

AS constructionProject, -在建项目

sum(CASE LEFT(CONVERT(VARCHAR,start_date,23),4) WHEN DateName(year,GetDate()) THEN 1 ELSE 0 END)

AS startThisYear, -今年开工

sum(CASE LEFT(CONVERT(VARCHAR,end_date,23),4) WHEN DateName(year,GetDate()) THEN 1 ELSE 0 END)

AS endThisYear, -今年完工

sum(CASE LEFT(RIGHT(CONVERT(VARCHAR,start_date,23),5),2) WHEN DateName(month,GetDate()) THEN 1 ELSE 0 END)

AS startThisMonth, -本月新增

sum(CASE LEFT(CONVERT(VARCHAR,end_date,23),7) WHEN LEFT(CONVERT(VARCHAR,GetDate(),23),7) THEN 1 ELSE 0 END)

AS endThisMonth, -本月完工

count(*) as projectCount -项目总数

from hocm_project AS pro

e org_id in (

SELECT id from sys_org where parent_id = '16b2a96f9b04428f8f9aca3b04b947e0'

)

发布于 2022-12-18 10:26 ・IP 属地广西