验证中...
Snippet 1 Snippet 2
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,
max(VISIT_ID) as VISIT_ID,
max(EMC_FLAG) as EMC_FLAG
FROM TMEDTECHFLOW t2
where CONVERT(varchar(10),EXECUTE_DATE,120)='2019-03-20'
and CHARINDEX(FLOW_SEQUENCE,'20190320085934057063,20190319091523617317')<=0
and BED_NO <> ''
GROUP BY MEDTECH_SEQ_NO
微信图片_20180518124209.jpg

Comment list( 0 )

You need to Sign in for post a comment

Help Search