Her er din forespørgsel omskrevet ved hjælp af ANSI-92 JOIN-syntaks:
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
(+)
er Oracle-specifik LEFT OUTER JOIN-syntaks. For at fjerne det, kræver det, at hver USER_INSTANCE.instance_number
skal have værdier for procestilstandene, der er alle tre:PLANNING, SETUP og OUTPUT - udelad en, og abx_apo_number vil ikke blive vist i outputtet.