I have a resources table, one of the fields is a date field with the Data Type of date. I want to have to following output:
Current month records (say May - year is not important)
Then the following (again, assuming May is the current month)
- June Records
- July Records
- August Records
- September Records
- October Records
- November Records
- December Records
- January Records
- February Records
- March Records
- April Records
Come June, June is the current month and then the order would be:
- July Records
- August Records
- ...
Here is my SQL...I don't know how to ORDER the output to achieve the desired order (5,6,7,8,9,10,11,12,1,2,3,4):
SELECT
resource_id,
resource_title,
resource_summary,
resource_category,
resource_status,
resource_date,
DATEPART(month, resource_date) AS resource_month,
DATEPART(day, resource_date) AS resource_day
FROM dbo.resources
WHERE (resource_category = N'Quotes')
AND (resource_status <> N'Draft')
I found this possible solution for MySQL:
but I'm missing something on my end.