473,411 Members | 1,980 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

is this possible? obtain the min and max of rows with discrete intervals?

I'm more unsure of myself these days:
Given a result set of rows with discrete date intevals; but rows may
be non contiguous in nature; Can a simple, non cursor driven query
produce a result with the min and max date intervals?
eg.
the result table R has the following rows
key1|level1|05/01/01|10/01/02|
key1|level1|01/01/01|04/30/01|
key1|level1|11/10/00|12/31/00|
key1|level1|06/01/00|10/09/00|
key1|level1|01/01/00|05/30/00|

**** some sql **** results in

key1|level1|11/10/00|10/01/02|
key1|level1|01/01/00|10/09/00|

Does this need recursion?
Mike
Nov 12 '05 #1
2 1327
Ian
Mike wrote:
I'm more unsure of myself these days:
Given a result set of rows with discrete date intevals; but rows may
be non contiguous in nature; Can a simple, non cursor driven query
produce a result with the min and max date intervals?
eg.
the result table R has the following rows
key1|level1|05/01/01|10/01/02|
key1|level1|01/01/01|04/30/01|
key1|level1|11/10/00|12/31/00|
key1|level1|06/01/00|10/09/00|
key1|level1|01/01/00|05/30/00|

**** some sql **** results in

key1|level1|11/10/00|10/01/02|
key1|level1|01/01/00|10/09/00|

Does this need recursion?
Mike

The question is, what defines the "discrete" intervals? In your
example, it looks like the first 3 rows are in one interval, and
the last 2 rows are in the other.

The only definition of the intervals I can see is that column3 is
either >= 11/10/00 or not. But how many intervals do you need?
With just 2 intervals as above, the query is simple; but if you
have a LOT of intervals the query gets complex very quickly (as the
intervals would be coded in the SQL statement).


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Nov 12 '05 #2
Ian,
Thanks... the actual number of intervals vary and can be quite a lot
if measured over years.
The key1 ( really an identifier) and the level1 are pulled from a
table where
distinct changes in time to another parameter (not shown or required
in the result set) produces the multi rows as shown in the example.
The result set I want is then the one, two, or more rows that would
show definite, contiguous intervals (given that no two rows
(intervals) can contain the same day) and each new row's start has to
be one day after the last row's end date. Hope that clears up your
first question.
I have been eyeing recursion or trees but wanted to know if this is
one of those questions that can't be answered without creating an
application. I also have a habit of complicating something, and I
wanted to get someone to agree that it is complex.
Thanks for your help,
Mike
Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

40
by: Ron Adam | last post by:
After considering several alternatives and trying out a few ideas with a modified list object Bengt Richter posted, (Thank You), I think I've found a way to make slice operation (especially far end...
13
by: Lyle Fairfield | last post by:
Suppose there are four identical rows in a table, save for some unique id which identifies each row. For example, John Doe and his three clones live in the same home, share the same dob, name,...
2
by: Francois Vanderseypen | last post by:
Imagine a discrete 2D space of any size. Say, you have a 100x100 pixels (.net) panel and you have discrete cells of 10x10 pixels. Thinking e.g. of the game of life. I would like to draw a line in...
5
by: Gaetan | last post by:
I would like to guarantee that only one session at a time can request exclusive access to an object stored in Application. The ownership of the object must last throughout multiple HTTP requests. ...
0
by: Alison Givens | last post by:
I have the following problem. (VB.NET 2003 with CR) I have a report with a multiple-value discrete value and a rangevalue. The report shows fine in the viewer, but when I hit the export to pdf...
13
by: Alison Givens | last post by:
....... that nobody knows the answer. I can't imagine that I am the only one that uses parameters in CR. So, my question again: I have the following problem. (VB.NET 2003 with CR) I have a...
12
by: deebeetwo | last post by:
Hello, I need to somehow relate certain records together in a table and I am wondering if this is possible in SQL at all. Consider the table definition below. I need to find all pairs that...
11
by: OllyJ | last post by:
Hi experts, I'm hoping you can help me with this.. I have recently found out how to use the INSERT INTO statement to add multiple records from a listbox to a table, I now need to UPDATE records in...
1
by: lenygold via DBMonster.com | last post by:
I found this query on older thread and i can not uderstand output interval pairs: How to find min and max values in date intervals: -------------------------------------------------- Input:...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.