0
SELECT  
hi_proins0.PROC_INST_ID_  processId,
act_re_procdef.NAME_ processName,
(
     #Unknown column 'hi_proins0.PROC_INST_ID_' in 'where clause'
   SELECT IFNULL(ct,0) FROM (
       SELECT COUNT(*) FROM act_hi_taskinst hi_task1
            INNER JOIN act_hi_procinst hi_proins1
                ON hi_task1.PROC_INST_ID_ = hi_proins1.PROC_INST_ID_
            WHERE  hi_proins1.PROC_INST_ID_ = hi_proins0.PROC_INST_ID_
                AND hi_task1.ASSIGNEE_ != hi_proins1.START_USER_ID_
                AND hi_task1.ASSIGNEE_ = hi_task0.ASSIGNEE_
            GROUP BY hi_task1.ASSIGNEE_
       ) ti

) approvalNodeCount,
(
   ...
) spendTime FROM 
  act_hi_taskinst hi_task0

LEFT JOIN act_hi_procinst hi_proins0 ON hi_proins0.PROC_INST_ID_ = hi_task0.PROC_INST_ID_
INNER JOIN act_re_procdef ON act_re_procdef.ID_ = hi_proins0.PROC_DEF_ID_ 
GROUP BY hi_proins0.PROC_INST_ID_

そして、「where句」で不明な列「hi_proins0.PROC_INST_ID_」をスローします

 SELECT IFNULL(ct,0) FROM (
   ...
 ) ti

ifnull は上記では機能しません

それを解決する方法は?:D

4

1 に答える 1

0

これを試して:

SELECT hi_proins0.PROC_INST_ID_  processId, act_re_procdef.NAME_ processName,
       IFNULL((SELECT COUNT(*) FROM act_hi_taskinst hi_task1
               INNER JOIN act_hi_procinst hi_proins1 ON hi_task1.PROC_INST_ID_ = hi_proins1.PROC_INST_ID_
               WHERE hi_proins1.PROC_INST_ID_ = hi_proins0.PROC_INST_ID_    AND 
                     hi_task1.ASSIGNEE_ != hi_proins1.START_USER_ID_ AND hi_task1.ASSIGNEE_ = hi_task0.ASSIGNEE_
               GROUP BY hi_task1.ASSIGNEE_
            ), 0 ) approvalNodeCount,
(
   ...
) spendTime 
FROM act_hi_taskinst hi_task0
LEFT JOIN act_hi_procinst hi_proins0 ON hi_proins0.PROC_INST_ID_ = hi_task0.PROC_INST_ID_
INNER JOIN act_re_procdef ON act_re_procdef.ID_ = hi_proins0.PROC_DEF_ID_ 
GROUP BY hi_proins0.PROC_INST_ID_
于 2013-01-09T05:27:16.637 に答える