• that looks like an accidental cross join to me.

    it explicitly says UPDATE DRPDATA, but since the FROM has the table name as being aliased,and the unaliased table is not referenced anywhere else, there is an implied cross join like this:

    UPDATE DRPDATA

    SET ....

    FROM DRPDATA A ,DRPDATA

    the UPDATE should be UPDATE ALIASNAME explicitly.

    -- ADD average FTE Hrs for the Week based table with daily data

    UPDATE A

    SET A.FTEHrsAVG =

    (

    SELECTAVG(B.FTEHrs)

    FROMDRPDATA B

    WHEREA.MWID = B.MWID

    AND

    DATEPART(ISO_WEEK,A.BEGINDATUM)= DATEPART(ISO_WEEK,B.BEGINDATUM)

    AND

    A.[Org eenheid code] = B.[Org eenheid code]

    AND

    B.FlexVast = 'VAST'

    GROUP BYB.MWID,b.[Org eenheid code], DATEPART(ISO_WEEK,B.BEGINDATUM)

    )

    FROMDRPDATA A;

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!