fboehlandt
Registered User.
- Local time
- Today, 22:40
- Joined
- Sep 5, 2008
- Messages
- 90
Hi everyone,
I have the following (normalized) table 'mytable' containing 4 fields:
[Fund]
Where Startdate and Enddate are dates and N is the expected number of observations between them. Because the information contained in 'mytable' is subjected to another INNER JOIN statement (which would require a separate query), I am looking for a way to circumvene the HAVING clause (happy to provide details as to why so) and necessity of two separate queries. A VBA script to prep the table above for any start/end date and query wanting to extract complete series only would also be appreciated. In a nutshell:
- Input is startdate and endate
- objective is to extract complete series only
- via a query not using the GROUP BY clause
Can anyone help please?
I have the following (normalized) table 'mytable' containing 4 fields:
[Fund]
Code:
[Date] [Return]
FundA 1001 Date1 Return1
FundA 1001 Date2 Return2
FundA 1001 Date3 Return3
...
FundA 1001 DateN ReturnN
FundB 1002 Date1 Return1
FundB 1002 Date2 Return2
FundB 1002 Date3 Return3
...
FundB 1002 DateN ReturnN
[I]mutatis mutandi for every fund of the database[/I]
For every fund thereis the same number of observations (about 200 for all relevant dates). However, not all funds will have reported in a given month (although the series are usually continuous). For example, one fund may have reported from Date1 to DateN whereas the next one only reported from Date10 to Date50. I need a general query that isolates funds that report throughout a specified time interval. As an example: all funds that reported between Date10 and Date50 but not those that are lacking observations in between. One way to do this is to use some type of GROUP BY clause:
[CODE]
WHERE mytable.MM_DD_YYYY>=#[COLOR=blue][B]Startdate[/B][/COLOR]# And mytable.MM_DD_YYYY<=#[COLOR=blue][B]Enddate[/B][/COLOR]#
GROUP BY mytable.Code
HAVING Count(mytable.return)=[COLOR=blue][B]N[/B][/COLOR];
Where Startdate and Enddate are dates and N is the expected number of observations between them. Because the information contained in 'mytable' is subjected to another INNER JOIN statement (which would require a separate query), I am looking for a way to circumvene the HAVING clause (happy to provide details as to why so) and necessity of two separate queries. A VBA script to prep the table above for any start/end date and query wanting to extract complete series only would also be appreciated. In a nutshell:
- Input is startdate and endate
- objective is to extract complete series only
- via a query not using the GROUP BY clause
Can anyone help please?