Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2012
    Posts
    41

    Unanswered: DB2 consecutive check query

    Hello All,

    I am looking for some help !

    I have the below table - sample screen shot with data attached.

    columns
    id
    ref
    times
    type
    status


    I need to run a query - that checks the last 3 consecutive times by distinct type

    so for example order by timestamp asc... if the last 3 records for type 326 = Y and the current value = N then change the current value to Y to match the last 3 records. I need to do this for all records. So it needs to check by time and type

    Any idea's

    Thanks in advance

  2. #2
    Join Date
    Aug 2012
    Posts
    41
    image attached
    Attached Thumbnails Attached Thumbnails consecutive query.png  

  3. #3
    Join Date
    Nov 2011
    Posts
    334
    I can not understand your question
    What do you mean "checks the last 3 consecutive times by distinct type"
    and what is the "current value"
    Maybe giving some example data and expect result will make the question more clear.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •