Unanswered: DB2 9.7 FETCH LAST ROW when value changes
I have a table of values from tag reads example below
What I want to do is show the last date when the tag was in a particular zone so I want to output records 4,7 and 10.
I am a little unsure how to structure the query so appreciate any assistance
I have changed my table as when I previously had ID which doesn't actually exist I just put it in to show which rows I wanted.
So the query should show WHERE TAGID = 'IRCODE00056394' as there are 12 tags but what the requirement is. SHOW the last time it was seen in a particular ZONE.
So I only want to show the last 7 days and each time it changed a zone what was the last time it was seen in the zone. So once it enters the zone then show the last time it was in the zone before it went to another zone.
I am guessing somehow I need to hold the last zone as a variable and then compare the next read
Thanks again for your help