J'ai déjà fait un post presque similaire, mais je la remets :
(Oracle a des problèmes avec le plan d'exécution)
SELECT DISTINCT adhe_no_bull, Cour_dat_eff,
Cour_nom_adhes,cour_cod_prod,cour_cod_part,
cour_cod_aven, DOCUMENTS.*
FROM COURRIERS, DOCUMENTS, Adhesions, adherents
WHERE DOCU_CODE = COUR_COD_AVEN
AND DOCU_TYPE = COUR_COD_PROD
AND COUR_COD_PROD =72
AND COUR_COD_AVEN ='GAIN'
and ADHE_NO_ADHES = COUR_NO_ADHES
and adhe_no_adher = adhr_no_adher
and adhr_dat_deces is null
and (adhe_dat_cpta is not Null)
and ((adhe_flg_transfert = 0 ) or (adhe_flg_transfert = 1 and adhe_cont_recep is not null))
and adhe_no_bull NOT IN ( select adhe_no_bull from adhesions, evenements
where adhe_cod_prod = even_cod_prod
and adhe_no_adhes = even_no_adhes
and adhe_cod_prod =72
and ( (adhe_dat_cpta is Null )
or (adhe_flg_transfert = 1 and adhe_cont_recep is null)
or even_dat_val is null)
and (adhe_cod_etat is null or not adhe_cod_etat in ('AL','A3'))
)
Message édité par manuhard le 18-02-2004 à 17:40:55