J
JbL
Hi,
I am trying to run the below query that selects a few fields from a table -
Date, Sect, and DlyReturn where it basically computes the average return each
for each company in the sector. That part is easy I know.
Then I'm trying to add a few add'l companies to incorporate into the average
calculation which is what I can't get to group properly by the date and calc
the daily average with the combined entries.
I can only get the listing of each company and it's return, not the average
of all of the comps in a sector AND select add'l comps that fall into another
sector
SELECT [DailyData].Date, [DailyData].Sect, Avg([DailyData].DlyReturn) AS
AvgOfDlyReturn
FROM DailyData
GROUP BY [DailyData].Date, [DailyData].Sect, [DailyData].Cusip
HAVING ((([DailyData].Date)>#4/1/2005#) AND (([DailyData].Sect)=10)) OR
((([DailyData].Date)>#4/1/2005#) AND (([DailyData].Cusip)="039380100")) OR
((([DailyData].Date)>#4/1/2005#) AND (([DailyData].Cusip)="704549104")) OR
((([DailyData].Date)>#4/1/2005#) AND (([DailyData].Cusip)="576206106"))
ORDER BY [DailyData].Date, [DailyData].Sect, Avg([DailyData].DlyReturn) DESC;
Thank you!!
I am trying to run the below query that selects a few fields from a table -
Date, Sect, and DlyReturn where it basically computes the average return each
for each company in the sector. That part is easy I know.
Then I'm trying to add a few add'l companies to incorporate into the average
calculation which is what I can't get to group properly by the date and calc
the daily average with the combined entries.
I can only get the listing of each company and it's return, not the average
of all of the comps in a sector AND select add'l comps that fall into another
sector
SELECT [DailyData].Date, [DailyData].Sect, Avg([DailyData].DlyReturn) AS
AvgOfDlyReturn
FROM DailyData
GROUP BY [DailyData].Date, [DailyData].Sect, [DailyData].Cusip
HAVING ((([DailyData].Date)>#4/1/2005#) AND (([DailyData].Sect)=10)) OR
((([DailyData].Date)>#4/1/2005#) AND (([DailyData].Cusip)="039380100")) OR
((([DailyData].Date)>#4/1/2005#) AND (([DailyData].Cusip)="704549104")) OR
((([DailyData].Date)>#4/1/2005#) AND (([DailyData].Cusip)="576206106"))
ORDER BY [DailyData].Date, [DailyData].Sect, Avg([DailyData].DlyReturn) DESC;
Thank you!!