[thelist] Iterate through result set - Is this possible? (SQL)
Ken Schaefer
Ken at adOpenStatic.com
Tue May 31 05:42:59 CDT 2005
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: thelist-bounces at lists.evolt.org [mailto:thelist-
: bounces at lists.evolt.org] On Behalf Of Burhan Khalid
: Subject: Re: [thelist] Iterate through result set - Is this possible?
: (SQL)
:
: Ken Schaefer wrote:
: > Hi,
: >
: > Your current requirements are ambiguous (because you can
: > have multiple events that have a start date > 7 days
: > after any given event start date)
:
: Yes I understand this, but I need the first available 7 day gap for a
: given hall, not a listing of all the events whose gap is 7 days or more.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can't "select" a 7 day gap. You can only select existing data.
I think you want to find, for a given starting date (e.g. today), two
consecutive records where:
a) the EndDate of Record1 is at least 7 days before the StartDate of Record2.
However you still need to define "consecutive" (etc)
b) the EndDate of Record1 is after today's date
But I am not sure. That's why I'd like you to clarify what you want.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: > Can you post a set of sample data, and what your expected output is? If
: you
: > can provide that, then we can write the necessary SQL (if it's possible)
: to
: > generate the output.
:
: I'll have to get remote access, but I'll post as soon as I can get it.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Just make up some data, eg:
Table1:
Field1 Field2
1 a
2 b
Table2:
Field2 Field3
1 c
2 d
Results
1 a
2 b
1 c
2 d
Cheers
Ken
--
www.adOpenStatic.com/cs/blogs/ken/
More information about the thelist
mailing list