R
ryguy7272
I don’t know for sure if Access can handle this request, but I know Queries
are pretty powerful, so I’m thinking it is possible. As I alluded to in the
title of the post, I’m trying to find a way to query for the average of
1-month stock returns, average of 3-month stock returns, average of 6-month
stock returns & average of 12-month stock returns.
This is my SQL now:
SELECT SharePrices.StockSymbol, Avg(SharePrices.StockPrice) AS AveragePrice,
tblStocksGroup.Company, tblStocksGroup.Group, tblStocksGroup.Class
FROM SharePrices INNER JOIN tblStocksGroup ON SharePrices.StockSymbol =
tblStocksGroup.Ticker
GROUP BY SharePrices.StockSymbol, tblStocksGroup.Company,
tblStocksGroup.Group, tblStocksGroup.Class
HAVING (((tblStocksGroup.Group)=[Forms]![frmMaster]![cboGroup]) AND
((tblStocksGroup.Class)=[Forms]![frmMaster]![cboClass]));
That gives me an average of my stock prices, but it is just an average of
all the stock prices in a table named ‘SharePrice’. Is there a way to do
what I described above? If I assume 250 trading days in a year (52*5 = 260 –
9 holidays = 251), I think I would first have to calculate the average based
on the number of days to get 21 (for 1 month), 63 (for 3 months), 125 (for
6-months), and 250 days.
Thanks so much!
Ryan--
are pretty powerful, so I’m thinking it is possible. As I alluded to in the
title of the post, I’m trying to find a way to query for the average of
1-month stock returns, average of 3-month stock returns, average of 6-month
stock returns & average of 12-month stock returns.
This is my SQL now:
SELECT SharePrices.StockSymbol, Avg(SharePrices.StockPrice) AS AveragePrice,
tblStocksGroup.Company, tblStocksGroup.Group, tblStocksGroup.Class
FROM SharePrices INNER JOIN tblStocksGroup ON SharePrices.StockSymbol =
tblStocksGroup.Ticker
GROUP BY SharePrices.StockSymbol, tblStocksGroup.Company,
tblStocksGroup.Group, tblStocksGroup.Class
HAVING (((tblStocksGroup.Group)=[Forms]![frmMaster]![cboGroup]) AND
((tblStocksGroup.Class)=[Forms]![frmMaster]![cboClass]));
That gives me an average of my stock prices, but it is just an average of
all the stock prices in a table named ‘SharePrice’. Is there a way to do
what I described above? If I assume 250 trading days in a year (52*5 = 260 –
9 holidays = 251), I think I would first have to calculate the average based
on the number of days to get 21 (for 1 month), 63 (for 3 months), 125 (for
6-months), and 250 days.
Thanks so much!
Ryan--