I have data I am trying to pull for a report and I am working on a Year to Date report. My columns in the table are formatted as datetime. I am trying to run a select statement to get all the results where date = this year.
SELECT A.[id], A.[classXML]
FROM tuitionSubmissions as A
WHERE A.[status] = 'Approved' AND A.[reimbursementDate] = THISYEAR
FOR XML PATH ('data'), TYPE, ELEMENTS, ROOT ('root');
Is there an eay way to acomplish this?
Yes, it’s remarkably easy in fact:
WHERE YEAR(A.[reimbursementDate]) = YEAR(GETDATE())