I have a download table that records every time an article is downloaded (_title.typeid=2 means the title is an article), and my SQL statement currently gets the top 10 most downloaded articles. My download table also has a column called dateTime to record exactly when each article is downloaded using a dateTime. Instead of getting the top 10 most downloaded articles of all time, I want to get the top 10 most downloaded articles within the last month, but I'm not sure how to do operations on the datetime.
How would I modify this SQL to only get the top 10 downloaded articles of the month?
SELECT TOP (10) _Download.titleidfk, COUNT(_Download.titleidfk) AS Downloads
FROM _Download INNER JOIN
_Title ON _Download.titleidfk = _Title.titleId
WHERE (_Title.typeId = '2')
GROUP BY _Download.titleidfk
ORDER BY Downloads DESC