验证中...
gistfile1.txt
Raw Copy
select
[FLOW_SEQUENCE] = stuff((SELECT ';' + [FLOW_SEQUENCE] FROM TMEDTECHFLOW t WHERE t.MEDTECH_SEQ_NO=t2.MEDTECH_SEQ_NO FOR xml path('')),1,1,''),
MEDTECH_SEQ_NO,
[ITEM_NAME] = stuff((SELECT ';' + [ITEM_NAME] FROM TMEDTECHFLOW t WHERE t.MEDTECH_SEQ_NO=t2.MEDTECH_SEQ_NO FOR xml path('')),1,1,''),
max(EXECUTE_DATE) as EXECUTE_DATE,
max(EXECUTE_TIME) as EXECUTE_TIME,
max(PAT_STATUS) as PAT_STATUS,
max(PAT_NAME) as PAT_NAME,
max(BED_NO) as BED_NO,
max(PAT_LABEL) as PAT_LABEL,
[REMARKS] = stuff((SELECT ';' + [REMARKS] FROM TMEDTECHFLOW t WHERE t.MEDTECH_SEQ_NO=t2.MEDTECH_SEQ_NO FOR xml path('')),1,1,''),
max(EXECUTE_DEPT) as EXECUTE_DEPT
FROM TMEDTECHFLOW t2
where CONVERT(varchar(10),INSERT_TIME,120)='2019-03-20'
and CHARINDEX(FLOW_SEQUENCE,'20190320085934057063,20190319091523617317')<=0
and PAT_TYPE = 'ZY'
GROUP BY MEDTECH_SEQ_NO

Comment list( 0 )

You need to Sign in for post a comment

Help Search