Zde je váš dotaz přepsaný pomocí syntaxe ANSI-92 JOIN:
SELECT a.abx_apo_number,
COUNT(ap1.process_mode) AS NUM_PLANNING,
COUNT(ap2.process_mode) AS NUM_SETUP,
COUNT(ap3.process_mode) AS NUM_OUTPUT
FROM ABX a
LEFT JOIN USER_INSTANCE u ON u.abx_apo_number = a.abx_apo_number
LEFT JOIN ACTIVE_PROCESS ap1 ON ap1.process_instance_number = u.instance_number
AND ap1.process_mode = 'PLANNING'
LEFT JOIN ACTIVE_PROCESS ap2 ON ap2.process_instance_number = u.instance_number
AND ap2.process_mode = 'SETUP'
LEFT JOIN ACTIVE_PROCESS ap3 ON ap3.process_instance_number = u.instance_number
AND ap3.process_mode = 'OUTPUT'
GROUP BY a.abx_apo_number
(+)
je syntaxe LEFT OUTER JOIN specifická pro Oracle. Chcete-li jej odstranit, vyžadovalo by to, aby každý USER_INSTANCE.instance_number
by musely mít hodnoty pro všechny tři procesní režimy:PLANNING, SETUP a OUTPUT - vynechejte jednu a abx_apo_number by se ve výstupu nezobrazovalo.