我想我的观点,选择最近的“手工处理”续约日期,但无法找到如何把MAX功能在查询可以一MAX在case语句也有CONVERT被合并(VARCHAR
ALTER VIEW [dbo].[cb_TrainingFar] AS
SELECT
ISNULL(cs_facilities.guid, '00000000-0000-0000-0000-000000000000') AS [FacilityGuid],
'' as DART_ALL,
ISNULL(cs_facilities.name,'') as [Facility name],
ISNULL (ct_workers.forenames,'') + ',' + ISNULL (ct_workers.surname,'') AS 'Name of worker/volunteer',
ISNULL (ct_workers.startDate, 0) As 'Start Date',
CASE when ct_qualificationTypes.type =
'Manual Handling'
THEN CONVERT (varchar, ct_qualifications.renewalDate)
ELSE 'Not completed'
END 'Manual Handling',
我认为你真的应该也加上你的'FROM'-和'WHERE'-子句 – DrCopyPaste
max是一个聚合函数。你有没有跟随最大值? – xQbert
ALTER VIEW [DBO]。[cb_TrainingFar] AS SELECT ISNULL (cs_facilities.guid, '00000000-0000-0000-0000-000000000000')AS [FacilityGuid], '' 作为DART_ALL, ISNULL(cs_facilities.name, '')as [工具名称], ISNULL(ct_workers.forenames,'')+','+ ISNULL(ct_workers.surname,'')AS'工人/志愿者姓名', ISNULL(ct_workers.startDate,0 ) '开始日期', CASE ct_qualificationTypes.type WHEN '手工处理' 然后将其转换(VARCHAR,ct_qualifications.renewalDate) ELSE '未完成' END '手工处理',请从添加*组ct_workers – user3257545