我想我的觀點,選擇最近的「手工處理」續約日期,但無法找到如何把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