I'm using a query for years but this time it makes me getting creasy ...
UPDATE TABLE_1 set TABLE_1.CHANGEMENT = 1 ,
TABLE_1.VALEUR_POINTS = TABLE_2.VALEUR_POINTS,
T = TABLE_2.DESIGNATION_PRODUI
FROM TABLE_2 JOIN TABLE_1 ON TABLE_1.REF_EDITEUR = TABLE_2.REF_EDITEUR AND TABLE_1.REF_PRODUIT = TABLE_2.REF_PRODUIT AND ACTUEL = 1
TABLE_2.REF_EDITEUR = 'ZIM'
AND TABLE_1.GAMME = TABLE_2.GAMME
AND TABLE_1.PROGRAM_TYPE = TABLE_2.PROGRAM_TYPE
AND( TABLE_1.VALEUR_POINTS <> TABLE_2.VALEUR_POINTS
T <> TABLE_2.DESIGNATION_PRODUI
this query should returned 0 because there is no entry to join.
TABLE_2 is a very little table (less than 300 entries)
if I run the query like this, it is running for a long, long , long time and have to stop it.
if I remove this line : AND TABLE_1.PROGRAM_TYPE = TABLE_2.PROGRAM_TYPE
it is running in 0 secs.
attached the estimated plan.
I added the option FORCE ORDER but it didn't help....
thanks to help me, very urgent and important ....