<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Verdana","sans-serif";
        color:navy;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Verdana","sans-serif";
        color:navy;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-NZ link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><span style='color:#1F497D'>I shall give that a try and get
back to you.<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>You know how it is, look at something
long enough and you eventually loose site of what you are trying to do
....aghhh......<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>Jeremy<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<div>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'> delphi-bounces@delphi.org.nz
[mailto:delphi-bounces@delphi.org.nz] <b>On Behalf Of </b>Xander (GMail)<br>
<b>Sent:</b> Sunday, 31 January 2010 10:47<br>
<b>To:</b> 'NZ Borland Developers Group - Delphi List'<br>
<b>Subject:</b> Re: [DUG] another set of eyes - correction<o:p></o:p></span></p>
</div>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Verdana","sans-serif";
color:navy'>Sorry, correction (on last line):<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Verdana","sans-serif";
color:navy'><o:p> </o:p></span></p>
<p class=MsoNormal>If I understand your problem correctly, the following should
work:<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>WHERE <o:p></o:p></p>
<p class=MsoNormal>
-- those that begin inside the range period:<o:p></o:p></p>
<p class=MsoNormal style='text-indent:36.0pt'>(START >= RangeStart AND START
<= RangeEnd) OR<o:p></o:p></p>
<p class=MsoNormal>
-- those that end inside the range period:<o:p></o:p></p>
<p class=MsoNormal style='text-indent:36.0pt'> (END >= RangeStart AND
END <= RangeEnd) OR<o:p></o:p></p>
<p class=MsoNormal style='text-indent:36.0pt'>-- those that begin before and
end after the range period:<o:p></o:p></p>
<p class=MsoNormal style='text-indent:36.0pt'>(START < RangeStart AND END
> RangeEnd) <o:p></o:p></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Verdana","sans-serif";
color:navy'><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Verdana","sans-serif";
color:navy'><o:p> </o:p></span></p>
<div>
<div class=MsoNormal align=center style='text-align:center'><span lang=EN-US
style='font-size:12.0pt;font-family:"Times New Roman","serif"'>
<hr size=2 width="100%" align=center>
</span></div>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'> Xander (GMail) [mailto:xandervdm@gmail.com]
<br>
<b>Sent:</b> Sunday, January 31, 2010 10:45 AM<br>
<b>To:</b> 'NZ Borland Developers Group - Delphi List'<br>
<b>Subject:</b> RE: [DUG] another set of eyes</span><span lang=EN-US
style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p>
</div>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Verdana","sans-serif";
color:navy'>Hi Jeremy,<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Verdana","sans-serif";
color:navy'><o:p> </o:p></span></p>
<p class=MsoNormal>If I understand your problem correctly, the following should
work:<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>WHERE <o:p></o:p></p>
<p class=MsoNormal>
-- those that begin inside the range period:<o:p></o:p></p>
<p class=MsoNormal style='text-indent:36.0pt'>(START >= RangeStart AND START
<= RangeEnd) OR<o:p></o:p></p>
<p class=MsoNormal>
-- those that end inside the range period:<o:p></o:p></p>
<p class=MsoNormal style='text-indent:36.0pt'> (END >= RangeStart AND
END <= RangeEnd) OR<o:p></o:p></p>
<p class=MsoNormal style='text-indent:36.0pt'>-- those that begin before and
end after the range period:<o:p></o:p></p>
<p class=MsoNormal style='text-indent:36.0pt'>(START <= RangeStart AND END
< RangeEnd) <o:p></o:p></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Verdana","sans-serif";
color:navy'><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Verdana","sans-serif";
color:navy'><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Verdana","sans-serif";
color:navy'>Cheers<o:p></o:p></span></p>
<div>
<div class=MsoNormal align=center style='text-align:center'><span lang=EN-US
style='font-size:12.0pt;font-family:"Times New Roman","serif"'>
<hr size=2 width="100%" align=center>
</span></div>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'> delphi-bounces@delphi.org.nz
[mailto:delphi-bounces@delphi.org.nz] <b>On Behalf Of </b>Jeremy Coulter<br>
<b>Sent:</b> Sunday, January 31, 2010 9:54 AM<br>
<b>To:</b> 'NZ Borland Developers Group - Delphi List'<br>
<b>Subject:</b> [DUG] another set of eyes</span><span lang=EN-US
style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p>
</div>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal>Hi All.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>I am the stage with problem that SOMEONE who’s a bit
more lateral thinking than me might be able to see the solution.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>I have the following data (just a snapshot).<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Item Start
End<o:p></o:p></p>
<p class=MsoNormal>1 15
Feb 2010 26 Feb 2010<o:p></o:p></p>
<p class=MsoNormal>2 22
Feb 2010 26 Feb 2010<o:p></o:p></p>
<p class=MsoNormal>3 15
Feb 2010 29 Feb 2010<o:p></o:p></p>
<p class=MsoNormal>4 24
Feb 2010 25 Feb 2010<o:p></o:p></p>
<p class=MsoNormal>5 23
Feb 2010 25 Feb 2010<o:p></o:p></p>
<p class=MsoNormal>6 24
Feb 2010 31 Feb 2010<o:p></o:p></p>
<p class=MsoNormal>7 22
Feb 2010 26 Feb 2010<o:p></o:p></p>
<p class=MsoNormal>8 23
Feb 2010 24 Feb 2010<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>What I am doing is TRYING to find all items that fall
between a given date range.<o:p></o:p></p>
<p class=MsoNormal>In this case I am trying to find all the items between the
22 Feb and 26 Feb.<o:p></o:p></p>
<p class=MsoNormal>i.e. all of the items should be returned in the above snap
shot.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>I am trying the following where clause (not real field
names):-<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>WHERE (#22 FEB 2010 13.00.00# Between START And END)<o:p></o:p></p>
<p class=MsoNormal>AND (#26 FEB 2010 10.00.00# Between START And END)<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>However, that missed out Items 1,34,5,6 and I think 8.<o:p></o:p></p>
<p class=MsoNormal>If I try:<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>WHERE START >=#22 FEB 2010 13.00.00# And ENDTIME <=#26
FEB 2010 10.00.00# <o:p></o:p></p>
<p class=MsoNormal>It misses out 1,3 and 6<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>I cant go<o:p></o:p></p>
<p class=MsoNormal>WHERE START >=#22 FEB 2010 13.00.00# or ENDTIME <=#26
FEB 2010 10.00.00# as that returns to many records.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Can anyone see what I am missing? I don’t mind if I have to
do it in separate queries as I can just union them, but I have been looking at
this too long and I just cant figure it out, so I thought another set of eyes
might help <span style='font-family:Wingdings'>J</span><o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Thanks, Jeremy<o:p></o:p></p>
<p class=MsoNormal> <o:p></o:p></p>
</div>
</body>
</html>