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拼接sql (),布布扣,bubuko.com
拼接sql ()
原文:http://www.cnblogs.com/dullbaby/p/3816263.html