CREATE OR REPLACE VIEW SD_HOSPITAL.VW_YK_YTKYPMX ( YPQLDH, YPQLPC, RKPC00, YPNM00, PZBSM0, YPMC00, YPGG00, FPH000, SCPH00, QLSL00, QLDW00, ZSMSL0, SMSL00, SMSLMC ) AS select A.YPQLDH, A.YPQLPC, B.YPRKPC RKPC00, A.YPNM00, --substrb((select to_char(wm_concat(PZBSM0)) from YK_YPZSM0 where YPNM00=A.YPNM00),1,200) PZBSM0, --药品标识码 c.PZBSM0, --药品标识码 A.YPMC00, A.YPGG00, '' FPH000, --B.FPH000 ( select SCPH00 from YK_YPRKMX where YPNM00 = A.YPNM00 and YPRKPC = B.YPRKPC ) SCPH00, ((B.CKSL00*B.ZHL000)/C.K2J000) QLSL00, --应扫码数量 B.CKDW00 QLDW00, floor((B.CKSL00*B.ZHL000)/C.K2J000) ZSMSL0, --应扫码数量 (select count(1) from YK_RKZSM0 where ZT0000 = '1' and YPNM00 = A.YPNM00 and YKRKPC = B.YPRKPC and YPTKPC=A.YPQLPC ) SMSL00, --已扫数量 (select to_char(count(1)) from YK_RKZSM0 where ZT0000 = '1' and YPNM00 = A.YPNM00 and YKRKPC = B.YPRKPC and YPTKPC=A.YPQLPC ) ||'/'||to_char(floor((B.CKSL00*B.ZHL000)/C.K2J000)) SMSLMC --已扫/应扫 from YK_YPQLMX A,YK_YPCKMX B,BM_YD0000 C where A.YPNM00 = B.YPNM00 and A.YPNM00 = C.YPNM00 and a.ypqldh=b.ypqldh and A.YPQLPC = B.YPQLPC /