I am getting nowhere transforming this VBA query in MS Access 2010 to VS 2010 Linq query to the MVC3 table model. This gets the last 10 quarters of the format "yyyy q""Qtr""" => sample: 2011 4Qtr. The 10 items are listed in a comboBox for selection to create an annual report starting from the selected quarter.
The easy way is to generate the string from today's date, not from the repository data. This is for learning purposes, so your help is appreciated if you got the time.
This is the VBA query:
SELECT TOP 10 Format([tblModel].[Dtime],"yyyy q""Qtr""") AS YearQ
FROM tblModel
GROUP BY Format([tblModel].[Dtime],"yyyy q""Qtr"""), 10
HAVING (((Format([tblModel].[Dtime],"yyyy q""Qtr"""))<=Format(DateAdd("yyyy",-1,Date()),"yyyy q""Qtr""")))
ORDER BY Format([tblModel].[Dtime],"yyyy q""Qtr""") DESC;
In C#, there is no "q" quarter format, and no Having method in Linq. Your guide and suggestions are appreciated.