[EMAIL PROTECTED] (Dawn) writes:
> I have a sql update statement that is dealing with hundreds of
> thousands of records.  It takes hours and hours to complete (if it
> does complete and not take down the server).

No wonder, if you write it like that.  You're forcing a fresh select
from gl_totals for each row of aud_member_ext_attributes; then you're
doing it again for each UPDATE command.

If you were using Postgres (which I surmise you are not, because it
doesn't accept aliases in UPDATE) you could do

update aud_member_ext_attributes
set
        EXTVALUE217 = gl_totals.MTD,
        EXTVALUE223 = gl_totals.YTD,
        EXTVALUE229 = gl_totals.R12
where gl_totals.category = 'tankrent' 
        and gl_totals.CUST_NO = EXTVALUE101 
        and gl_totals.DIST_NO = EXTVALUE102 
        and gl_totals.SUB_NO = EXTVALUE105 
        and gl_totals.FUEL_TYPE = EXTVALUE123;

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://www.postgresql.org/search.mpl

Reply via email to