Hello,
I have a stored procedure where I need criteria on the YOG that says if the current month is > 9 then YOG = Year(date() else YOG = Year(date() - 1).
I have this case statement but don't know where it should go in the SELECT:
CASE When month(getdate()) > 9 then Year(getdate()) else Year(getdate()) - 1.
SELECT StudMR.StudMRGradYear AS YOG,
StudMR.StudMRSchoolID
FROM StudMR
INNER JOIN Schools ON StudMR.StudMRSchoolID = Schools.SchoolID
WHERE (((Schools.SchoolType)='exam' Or
(Schools.SchoolType)='district' Or
(Schools.SchoolType)='alternative'))
GROUP BY StudMR.StudMRGradYear,
StudMR.StudMRSchoolID
ORDER BY StudMR.StudMRGradYear DESC;
Thank you in advance.
I have a stored procedure where I need criteria on the YOG that says if the current month is > 9 then YOG = Year(date() else YOG = Year(date() - 1).
I have this case statement but don't know where it should go in the SELECT:
CASE When month(getdate()) > 9 then Year(getdate()) else Year(getdate()) - 1.
SELECT StudMR.StudMRGradYear AS YOG,
StudMR.StudMRSchoolID
FROM StudMR
INNER JOIN Schools ON StudMR.StudMRSchoolID = Schools.SchoolID
WHERE (((Schools.SchoolType)='exam' Or
(Schools.SchoolType)='district' Or
(Schools.SchoolType)='alternative'))
GROUP BY StudMR.StudMRGradYear,
StudMR.StudMRSchoolID
ORDER BY StudMR.StudMRGradYear DESC;
Thank you in advance.