我正在尝试仅提取我目前拥有的日期时间格式的时间。到目前为止,这是我的查询。我想只为我正在创建的列提取时间(First_Arrival,Last_Arrival等)
SELECT logon_id,activity_date
,MIN(CASE WHEN activity = 'AsnAssignmentOnSite_evt' THEN occurred END) First_Arrival
,MAX(CASE WHEN activity = 'AsnAssignmentOnSite_evt' THEN occurred END) Last_Arrival
,MIN(CASE WHEN activity = 'OrdActivityComplete_evt' THEN occurred END) First_Completion
,MAX(CASE WHEN activity = 'OrdActivityComplete_evt' THEN occurred END) Last_Completion
,MIN(CASE WHEN activity = 'AsnAssignmentEnRoute_evt' THEN occurred END) First_Enroute
,MAX(CASE WHEN activity = 'AsnAssignmentEnRoute_evt' THEN occurred END) Last_Enroute
FROM activity
GROUP BY logon_id,activity_date
order by ACTIVITY_DATE