The flow of an UPDATE STATEMENT with a FROM CLAUSE

  • Chris Morris (11/18/2008)


    Is it just me or are the edit windows getting wider and wider today?

    Heh, yeah, John is a bit tab happy. I usually use the prettifier to remove all the extra extra tabs so that I can read it :hehe:.

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. ๐Ÿ˜‰

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • I ran both mine and your updated statement...

    How do interpret the Execution plan??? or should I post this as new question?

    mine a

    mine b

    urs a

    urs b

  • Hi John

    Compare the SELECT component of each statement.

    Row count

    Values if you feel it is necessary

    Time.

    This is what I mean by the SELECT component:

    [font="Courier New"]SELECT [P].[LAST_PAYMENT_DATE]

       ,.[NEXT_PAYMENT_DATE]

       ,[P].[CUR_PAYMENT]

       ,.[AVG_PMT_FREQ]

    FROM [dbo].[Amortization] [A]

    INNER JOIN [##PS]        [P]

       ON [A].[ID_NUMBER] = [P].[ID_NUMBER]

    INNER JOIN [##PS]        

       ON [A].[ID_NUMBER] = .[ID_NUMBER]

    WHERE [A].[TBL_SOURCEID] <> '1'

       AND [P].[RECCNT] = 1

       AND .[RECCNT] = 2

    [/font]

    Cheers

    ChrisM

    โ€œWrite the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.โ€ - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden

  • Opps - already answered

  • Already answer - something wrong with my connection today.

Viewing 5 posts - 16 through 21 (of 21 total)

You must be logged in to reply to this topic. Login to reply