K
KiowaPilot
I am trying to create a query that calculates the number of days remaining
for multiple individuals within a six month window based on their birthmonth
and what window based on the current date. I am easily able to calculate the
number of days remaining in both windows but I only want Info for the current
window for a report.
I believe that I have the WHERE clause correct but I don't know where I am
going wrong.
SELECT Pilots.LName, [Pilots.End1stSemi]-(Date()) AS 1st,
[Pilots.End2ndSemi]-(Date()) AS 2nd
FROM Pilots
WHERE (((Date()) Between [Start1stSemi] And [End1stSemi] Or (Date()) Between
[Start2ndSemi] And [End2ndSemi]));
the Table, Pilots Looks Like:
Lname BirthMonth Start1stSemi End1stSemi Start2ndSemi
End2ndSemi
Chris Aug 1 Sep 09 28 Feb 10 1 Mar 09
31 Aug 09
Mike Sep 1 Oct 08 31 Mar 09 1 Apr 09
30 Sep 09
Harold May 1 Jun 10 30 Nov 10 1 Dec 08
31 May 09
Joe Jan 1 Feb 09 31 Jul 09 1 Aug
09 31 Jan 10
If todays date was 3 Mar 09. What I am trying to do would look like:
Lname Daystillend
Chris 181
Mike 28
Harold 89
Joe 150
for multiple individuals within a six month window based on their birthmonth
and what window based on the current date. I am easily able to calculate the
number of days remaining in both windows but I only want Info for the current
window for a report.
I believe that I have the WHERE clause correct but I don't know where I am
going wrong.
SELECT Pilots.LName, [Pilots.End1stSemi]-(Date()) AS 1st,
[Pilots.End2ndSemi]-(Date()) AS 2nd
FROM Pilots
WHERE (((Date()) Between [Start1stSemi] And [End1stSemi] Or (Date()) Between
[Start2ndSemi] And [End2ndSemi]));
the Table, Pilots Looks Like:
Lname BirthMonth Start1stSemi End1stSemi Start2ndSemi
End2ndSemi
Chris Aug 1 Sep 09 28 Feb 10 1 Mar 09
31 Aug 09
Mike Sep 1 Oct 08 31 Mar 09 1 Apr 09
30 Sep 09
Harold May 1 Jun 10 30 Nov 10 1 Dec 08
31 May 09
Joe Jan 1 Feb 09 31 Jul 09 1 Aug
09 31 Jan 10
If todays date was 3 Mar 09. What I am trying to do would look like:
Lname Daystillend
Chris 181
Mike 28
Harold 89
Joe 150