SELECT ID,FORMNAME,NODENAME,SEQUENCE, NAME, STATE, NOWTIMES,
WORK.FQREALNAME||'('||FQDEPT.FULLNAME||')' AS FQREALNAME,
NVL2(WORK.BHREALNAME,WORK.BHREALNAME||'('||BHDEPT.FULLNAME||')','') AS BHREALNAME
FROM OA_WF_BHWORKFLOW WORK
LEFT OUTER JOIN (SELECT FULLNAME,USERID FROM SYS_USER USERNAME LEFT OUTER JOIN SYS_ORGANIZATION DEPT ON USERNAME.DEPARTMENTID=DEPT.ORGANIZATIONID )FQDEPT
ON FQDEPT.USERID=WORK.FQUSERNAME
LEFT OUTER JOIN (SELECT FULLNAME,USERID FROM SYS_USER USERNAME LEFT OUTER JOIN SYS_ORGANIZATION DEPT ON USERNAME.DEPARTMENTID=DEPT.ORGANIZATIONID )BHDEPT
ON BHDEPT.USERID=WORK.BHUSERNAME
WHERE
YJBOBJECTID='$YJBOBJECTID$'
ORDER BY SEQUENCE DESC
WORK.FQREALNAME||'('||FQDEPT.FULLNAME||')' AS FQREALNAME,
NVL2(WORK.BHREALNAME,WORK.BHREALNAME||'('||BHDEPT.FULLNAME||')','') AS BHREALNAME
FROM OA_WF_BHWORKFLOW WORK
LEFT OUTER JOIN (SELECT FULLNAME,USERID FROM SYS_USER USERNAME LEFT OUTER JOIN SYS_ORGANIZATION DEPT ON USERNAME.DEPARTMENTID=DEPT.ORGANIZATIONID )FQDEPT
ON FQDEPT.USERID=WORK.FQUSERNAME
LEFT OUTER JOIN (SELECT FULLNAME,USERID FROM SYS_USER USERNAME LEFT OUTER JOIN SYS_ORGANIZATION DEPT ON USERNAME.DEPARTMENTID=DEPT.ORGANIZATIONID )BHDEPT
ON BHDEPT.USERID=WORK.BHUSERNAME
WHERE
YJBOBJECTID='$YJBOBJECTID$'
ORDER BY SEQUENCE DESC