SELECT tblAccounts.msAccount, tblFiscalCalendar.yrMonth, Avg(qryFinalDailyAnalytics.origCost) AS AvgOforigCost, Avg(qryFinalDailyAnalytics.bookValue) AS AvgOfbookValue, Avg(qryFinalDailyAnalytics.accrInt) AS AvgOfaccrInt, Avg(qryFinalDailyAnalytics.mktValue) AS AvgOfmktValue, Avg(qryFinalDailyAnalytics.purchYield) AS AvgOfpurchYield, Avg(qryFinalDailyAnalytics.currYield) AS AvgOfcurrYield, Avg(qryFinalDailyAnalytics.duration) AS AvgOfduration, Avg(qryFinalDailyAnalytics.DTEM) AS AvgOfDTEM, Avg(qryFinalDailyAnalytics.DTFM) AS AvgOfDTFM
FROM (tblAccounts LEFT JOIN tblFiscalCalendar ON tblAccounts.calendarID = tblFiscalCalendar.calendarId) LEFT JOIN qryFinalDailyAnalytics ON tblFiscalCalendar.calendarId = qryFinalDailyAnalytics.calendarID
WHERE (((qryFinalDailyAnalytics.dataDate) Between [startDate] And [endDate]))
GROUP BY tblAccounts.msAccount, tblFiscalCalendar.yrMonth
ORDER BY tblAccounts.msAccount, tblFiscalCalendar.yrMonth;
|