我被要求创建2个报告,一个用于主要课程的出席和另一个由讲师出席。
两个报告都使用相同的数据源和数据集,但报告中的参数和组是不同的。
我的mgr表示两份报告中的总数应该匹配。我不确定这是否可行。请告诉我。
Query1:
SELECT DISTINCT PrimaryProgramme, PRPH_Title, PRPH_ML1, Section, AgeBand, RegYear, Section_Name, REGT_Provision_Code, Student_ID, CourseType, Mins_Poss, Mins_Att, Mins_Late, TermTimeWeekNo, Surname, Forename, AttendanceMark, WeekStart, Class_Register COLLATE DATABASE_DEFAULT + ' - ' + Register_Title COLLATE DATABASE_DEFAULT + ' - ' + Register_Day COLLATE DATABASE_DEFAULT + ' ' + CONVERT(char(5), StartTime, 108) + ' - ' + CONVERT(char(5), EndTime, 108) AS Register
FROM CurrentAttendance_New
WHERE (AgeBand IN (@AgeBand)) AND (CourseType IN (@CourseType)) AND (RegYear = @Year)
ORDER BY PrimaryProgramme
Sample data:
PrimaryProgramme PRPH_Title PRPH_ML1 Section AgeBand RegYear Section_Name CourseType Mins_Poss Mins_Att Mins_Late Surname Forename Register
11017 Access to Nursing AP1 H+SC 19+ 2015 AP1 Health+Social Care** FunctionalSkill 0 0 0 Cummings Sornia 000018574 - English E3 FS Day (Pearson) - Monday 09:30 - 11:30
11017 Access to Nursing AP1 H+SC 19+ 2015 AP1 Health+Social Care** FunctionalSkill 0 0 0 Cummings Sornia 000018587 - Maths E2 FS Day (Pearson) - Friday 09:30 - 11:30
11017 Access to Nursing AP1 H+SC 19+ 2015 AP1 Health+Social Care** FunctionalSkill 0 0 0 Dobson Jodie 000018574 - English E3 FS Day (Pearson) - Monday 09:30 - 11:30
11017 Access to Nursing AP1 H+SC 19+ 2015 AP1 Health+Social Care** FunctionalSkill 60 60 60 Cummings Sornia 000018574 - English E3 FS Day (Pearson) - Monday 09:30 - 11:30
11017 Access to Nursing AP1 H+SC 19+ 2015 AP1 Health+Social Care** FunctionalSkill 105 105 15 Cummings Sornia 000018574 - English E3 FS Day (Pearson) - Monday 09:30 - 11:30
11017 Access to Nursing AP1 H+SC 19+ 2015 AP1 Health+Social Care** GCSE 0 0 0 Hyland Brenda 000019736 - GCSE Maths Friday Day (Pearson) - Friday 11:00 - 13:30
11017 Access to Nursing AP1 H+SC 19+ 2015 AP1 Health+Social Care** GCSE 0 0 0 Pemberton Charlotte 000019653 - GCSE English (AQA) Wed 9.30-12.00 - Wednesday 09:30 - 12:00
11017 Access to Nursing AP1 H+SC 19+ 2015 AP1 Health+Social Care** GCSE 0 0 0 Pemberton Charlotte 000019736 - GCSE Maths Friday Day (Pearson) - Friday 11:00 - 13:30
11017 Access to Nursing AP1 H+SC 19+ 2015 AP1 Health+Social Care** GCSE 150 0 0 Lynes Anne-Marie 000019655 - GCSE Maths Thu 6.30-9.00 (Pearson) - Thursday 18:30 - 21:00
11017 Access to Nursing AP1 H+SC 19+ 2015 AP1 Health+Social Care** Main 0 0 0 Agyeiwaa Yaa Maame 000018531 - Access To Nursing - Thursday 11:15 - 13:00
11017 Access to Nursing AP1 H+SC 19+ 2015 AP1 Health+Social Care** Main 0 0 0 Burgin Sarah 000018515 - Access To Nursing - Wednesday 09:30 - 11:00
11017 Access to Nursing AP1 H+SC 19+ 2015 AP1 Health+Social Care** Main 0 0 0 Burgin Sarah 000018537 - Access To Nursing - Thursday 13:45 - 15:15
11017 Access to Nursing AP1 H+SC 19+ 2015 AP1 Health+Social Care** Main 0 0 0 Cummings Sornia 000018497 - Access To Nursing - Tuesday 09:30 - 11:00
12647 BTEC L1 Diploma for IT Users (ITQ) (Pearson) AP2 INFT 1618 2015 AP2 Information Technology** Addition 0 0 0 Eldridge Tommy 000019207 - Employability - Tuesday 10:00 - 10:30
12647 BTEC L1 Diploma for IT Users (ITQ) (Pearson) AP2 INFT 1618 2015 AP2 Information Technology** Addition 0 0 0 Fox Edward 000019207 - Employability - Tuesday 10:00 - 10:30
12647 BTEC L1 Diploma for IT Users (ITQ) (Pearson) AP2 INFT 1618 2015 AP2 Information Technology** Addition 0 0 0 Hill Kristopher 000019202 - Tutorial + Enrichment 1 Yr - Tuesday 09:00 - 10:00
12647 BTEC L1 Diploma for IT Users (ITQ) (Pearson) AP2 INFT 1618 2015 AP2 Information Technology** Addition 0 0 0 Langley George 000017956 - Tutorial + Enrichment 1 Yr - Tuesday 09:00 - 10:00
Query 2:
SELECT DISTINCT
Lecturer_Code, LecturerName, AgeBand, RegYear, PRPH_ML1,
[Curriculum Area], PRPH_Title, Section, Section_Name,
Class_Register COLLATE DATABASE_DEFAULT + ' - ' +
Register_Title COLLATE DATABASE_DEFAULT + ' - ' + Register_Day COLLATE DATABASE_DEFAULT + ' ' + CONVERT(char(5),
StartTime, 108) + ' - ' + CONVERT(char(5), EndTime, 108) AS Register,
CourseType, Mins_Poss, Mins_Att, Mins_Late, TermTimeWeekNo, WeekStart, Class_Register,
Register_Title, Register_Day, StartTime, EndTime, PrimaryProgramme,
Lecturer_Section, Lecturer_Department
FROM CurrentAttendance_New
WHERE (RegYear = @Year) AND (LecturerName IN (@Lecturer))
GROUP BY Lecturer_Code, LecturerName, AgeBand, RegYear, PRPH_ML1,
[Curriculum Area], PRPH_Title, Section, Section_Name, CourseType, Mins_Poss, Mins_Att,
Mins_Late, TermTimeWeekNo, WeekStart, Class_Register, Register_Title,
Register_Day, StartTime, EndTime, PrimaryProgramme, Lecturer_Section,
Lecturer_Department
ORDER BY LecturerName, CourseType