Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Select cast(year(MyDateField) as varchar) + cast(month(MyDateField) as varchar) as Month,
count(Sales) as SalesTotal
From MyTable
Where MyDateField > 'Whatever Date'
Group By cast(year(MyDateField) as varchar) + cast(month(MyDateField) as varchar)
declare @StartDate datetime, @PriorDate datetime -- if you use SQL Server 2008, then use date
set @StartDate = getdate()
set @PriorDate = dateadd(month,-12+DATEDIFF(month,'19000101',@StartDate),'19000101')
Select cast(year(MyDateField) as varchar) + cast(month(MyDateField) as varchar(30)) as Month,
count(Sales) as SalesTotal
From MyTable
Where MyDateField >= @PriorDate and MyDateField <=@StartDate
Group By cast(year(MyDateField) as varchar) + cast(month(MyDateField) as varchar(30))