我遇到了问题,我想总结一下我的结果列,这是我的代码:
SELECT
[study_service]
,DATEDIFF(minute,[study_date_arrivee],[study_date_patient_prepared]) as [Time-ARRIVED-PREPARED]
,DATEDIFF(minute,[study_date_arrivee],[study_date_start]) as [Time-ARRIVED-START]
,DATEDIFF(minute,[study_date_start],[study_date_dossier_pret]) as [Time-START-DOSSPRET]
,DATEDIFF(minute,[study_date_dossier_pret],[study_date_remise_resultat]) as [Time-DOSSPRET-DOSSREMIS]
FROM
[VisionTST].[dbo].[PremierTrimestre]
我希望最终结果如下:
Total of `[Time-ARRIVED-PREPARED]`,`[Time-ARRIVED-Start]`,...
答案 0 :(得分:0)
SELECT
[study_service]
,sum(DATEDIFF(minute,[study_date_arrivee],[study_date_patient_prepared])) as [Time-ARRIVED-PREPARED]
,sum(DATEDIFF(minute,[study_date_arrivee],[study_date_start])) as [Time-ARRIVED-START]
,sum(DATEDIFF(minute,[study_date_start],[study_date_dossier_pret])) as [Time-START-DOSSPRET]
,sum(DATEDIFF(minute,[study_date_dossier_pret],[study_date_remise_resultat])) as [Time-DOSSPRET- DOSSREMIS]
FROM [VisionTST].[dbo].[PremierTrimestre]