I am running the below code and it does work but it is taking almost 10 minutes to run. The profit_c_acct_gal field is unique to the prft_ctr in the adjoining column but there are multiple entries for it. When I ran this with out the max() i kept getting a duplicate column error. Any input?
SQL
databasefactor;updateg_fuel_prftsetdest_cust=(selectmax(profit_c_acct_gal)lfromg_dlr_mstrwhereprft_ctr=g_fuel_prft.prft_ctranddest_cust=0andprofit_c_acct_galISNOTNULL)whereexists(select1fromg_dlr_mstrl2whereprft_ctr=g_fuel_prft.prft_ctranddest_cust=0andprofit_c_acct_galISNOTNULL)