endpoints of "most recent" range in ordered sequence
From: Tracy (Tracy_at_discussions.microsoft.com)
Date: 01/13/05
- Next message: Mark J. McGinty: "Re: which grid supports serverside cursor?"
- Previous message: Klausen: "Re: CASE for flow control?"
- Next in thread: Alejandro Mesa: "RE: endpoints of "most recent" range in ordered sequence"
- Reply: Alejandro Mesa: "RE: endpoints of "most recent" range in ordered sequence"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 13 Jan 2005 11:57:01 -0800
Suppose I have a history table with a key, a version of history, and another
value (which can be null). I need to locate the endpoints of the most recent
range of history records having a set of contiguous null values. An example
follows, along with desired results (and invalid results):
key version optional_val
1 1 10
1 2 null
1 3 null
1 4 15 (most current version of key = 1)
2 1 null
2 2 null
2 3 10
2 4 null
2 5 null
2 6 null
2 7 22
2 8 24 (most current version of key = 2)
For results, I want:
key min_version max_version
1 2 3
2 4 6
(notice how, for key = 2, I do NOT want to go back to that older bunch of
null-valued records).
I've been looking at 2- and 3-way self-joins here, and so far, nothing but
blue smoke coming out of my ears. All suggestions on how to think of this
problem appreciated.
Tracy Slack
- Next message: Mark J. McGinty: "Re: which grid supports serverside cursor?"
- Previous message: Klausen: "Re: CASE for flow control?"
- Next in thread: Alejandro Mesa: "RE: endpoints of "most recent" range in ordered sequence"
- Reply: Alejandro Mesa: "RE: endpoints of "most recent" range in ordered sequence"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|