Finding values

  • Sorry this could be a bit hard to explain

    I have a table that is built by a third party company that watch's the status of a field anytime a record is modified.

    Example

    ID StatusID Date Changed Unit ID

    48158 1 01/01/2014 12

    48159 5 02/04/2014 17

    48158 3 02/04/2014 12

    48158 5 02/07/2014 12

    48158 3 02/08/2014 12

    So the statusID can change around depending on what the status of the item is when the change is made. The unit number comes from another table which is joined to the history table. Now what I need to do is find any job that was a 3 then became a 5 as the last transaction. If it went back to a 3 the current status will show it but I need to see the past thing.

    Hope that makes sense.

  • See attached image this might make a bit more sense. So as you can see it can switch back and forth. So right now on the working table the status is 5. But I need to find the ones that went 3-5 as you can see at the bottom.

    thanks

  • How about to see the CDC option for that table.

    Link to start - http://technet.microsoft.com/en-us/library/bb522649(v=sql.105).aspx

    Igor Micev,My blog: www.igormicev.com

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

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