select cast(datediff(dd,PlanStartDate,PlanEndDate)as varchar(8))+'天' as timesub from [OA_WEB_DB].[dbo].[OA_DT_ProjectApply] where Project_Id='5'
datediff 为时间相减函数,datatime类型的。
cast 为把相减的结果 int 类型转换为 varchar 类型 并增加上 ‘天’ 字
select cast(datediff(dd,PlanStartDate,PlanEndDate)as varchar(8))+'天' as timesub from [OA_WEB_DB].[dbo].[OA_DT_ProjectApply] where Project_Id='5'
datediff 为时间相减函数,datatime类型的。
cast 为把相减的结果 int 类型转换为 varchar 类型 并增加上 ‘天’ 字