-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
USE [Campus6] | ||
GO | ||
|
||
SET ANSI_NULLS ON | ||
GO | ||
|
||
SET QUOTED_IDENTIFIER ON | ||
GO | ||
|
||
CREATE VIEW [custom].[vwOrderedTerms] | ||
AS | ||
/*********************************************************************** | ||
Description: | ||
Return a gapless list of terms in order. This may require customization for your institution's academic calendar. | ||
Usage: | ||
Revision History: | ||
2023-10-02 Wyatt Best: Created | ||
************************************************************************/ | ||
SELECT ACADEMIC_YEAR | ||
,ACADEMIC_TERM | ||
,RANK() OVER ( | ||
ORDER BY [START_DATE] | ||
) [TermId] --Rank Terms | ||
FROM ( | ||
SELECT --Get the earliest row for each ACADEMIC_TERM | ||
ACADEMIC_YEAR | ||
,ACADEMIC_TERM | ||
,MIN(START_DATE) [START_DATE] | ||
FROM ACADEMICCALENDAR | ||
GROUP BY ACADEMIC_YEAR | ||
,ACADEMIC_TERM | ||
) [MinTerms] | ||
|
||
/* | ||
--Alternate example method | ||
SELECT ACADEMIC_YEAR | ||
,ACADEMIC_TERM | ||
,RANK() OVER ( | ||
ORDER BY ACADEMIC_YEAR | ||
,CAT.SORT_ORDER | ||
) [TermId] | ||
FROM ACADEMICCALENDAR ACAL | ||
INNER JOIN CODE_ACATERM CAT | ||
ON CAT.CODE_VALUE_KEY = ACAL.ACADEMIC_TERM | ||
GROUP BY ACADEMIC_YEAR | ||
,ACADEMIC_TERM | ||
,CAT.SORT_ORDER | ||
*/ | ||
|
||
GO | ||
|
||
|