Comparing two rows in one table for changes in column

  • I need to create a background job that processes a table looking for rows matching on a particular id with different statuses. It will store the row data in a string to compare the data against a row with a matching id.

    I know the syntax to get the row data but i have never tried comparing 2 rows from the same table before? How is it done? Would i need to use variables to store the data from each? Or some other way?

    Mercedes Benz 400SE Parts

  • ashiqkhan98

    You are more likely to receive tested assistance if you post your table definition, provide some sample data (this may be fabricated data, so as not to reveal company confidential information, but still representative) as per the first link in my signature block.

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • Heh... ol' BitBucket beat me to it. See the link he refers you to because there are many ways of doing what you ask. Without data expressed in a readily consumable format, there's not much chance of actually helping you, though. And please do look at the link he referred you to for how to post data in a "readily consumable format".

    Thanks.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 3 posts - 1 through 2 (of 2 total)

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